{"action":"created","comment":{"url":"https://api.github.com/repos/dwarvesf/glod/pulls/comments/125598882","pull_request_review_id":48001556,"id":125598882,"diff_hunk":"@@ -35,47 +35,59 @@ type Format struct {\n }\n \n // function that download single video\n-func DownloadSingleVideo(video_id string) string {\n+func DownloadSingleVideo(video_id string) (Response, error) {\n+\tvar song Response\n+\n \tquery_string, err := fetchMeta(video_id)\n \tif err != nil {\n-\t\treturn \"\"\n+\t\treturn song, errors.New(\"Cannot fetchMeta\")\n \t}\n-\tvideo, err := parseMeta(video_id, query_string)\n \n+\tsong, err = parseMeta(video_id, query_string)\n \tif err != nil {\n-\t\treturn \"\"\n+\t\treturn song, errors.New(\"Cannot parseMeta\")\n \t}\n-\t//generate file name\n-\tfilename := video.Title + \".\" + video.GetExtension(0)\n \n-\treturn video.Formats[0].Url + \"~\" + filename\n+\treturn song, nil\n }\n \n // function that receive input is a link and output doesnt matter(but it override GetDirectLink of Glod interface)\n-func (youtube *Youtube) GetDirectLink(link string) ([]string, error) {\n+func (youtube *Youtube) GetDirectLink(link string) ([]Response, error) {\n+\tvar listSong []Response\n+\tvar song Response\n+\n \tif link == \"\" {\n \t\treturn nil, errors.New(\"Empty Link\")\n \t}\n \n-\tvar listStream []string\n+\tif strings.Contains(link, \"&list=\") {\n+\t\tlink = ToPlayList(link)\n+\t}\n \n \tif strings.Contains(link, album) {\n-\t\tvar listLink []string\n+\t\tvar listVideoID []string\n \t\tdoc, err := goquery.NewDocument(link)\n \t\tif err != nil {\n \t\t\treturn nil, err\n \t\t}\n \n \t\tdoc.Find(\".pl-video\").Each(func(i int, s *goquery.Selection) {\n-\t\t\ta, _ := s.Attr(\"data-video-id\")\n-\t\t\tlistLink = append(listLink, a)\n+\t\t\tvideoID, _ := s.Attr(\"data-video-id\")\n+\t\t\tlistVideoID = append(listVideoID, videoID)\n \t\t})\n-\t\tfor i := 0; i < len(listLink); i++ {\n-\t\t\tif DownloadSingleVideo(listLink[i]) != \"\" {\n-\t\t\t\tlistStream = append(listStream, DownloadSingleVideo(listLink[i]))\n+\t\tfor i := 0; i < len(listVideoID); i++ {\n+\t\t\tsong, err := DownloadSingleVideo(listVideoID[i])\n+\t\t\tif err != nil {\n+\t\t\t\tsong = GetTitleAndArtist(link, i)\n \t\t\t}\n+\t\t\tlistSong = append(listSong, song)\n+\t\t}\n+\t\tfor i, _ := range listSong {","path":"youtube/youtube.go","position":90,"original_position":90,"commit_id":"9d19a8c01a47bd19648d243123307de07edd796a","original_commit_id":"9d19a8c01a47bd19648d243123307de07edd796a","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars3.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"should omit 2nd value from range; this loop is equivalent to `for i := range ...`","created_at":"2017-07-05T09:44:05Z","updated_at":"2017-07-05T09:44:05Z","html_url":"https://github.com/dwarvesf/glod/pull/37#discussion_r125598882","pull_request_url":"https://api.github.com/repos/dwarvesf/glod/pulls/37","_links":{"self":{"href":"https://api.github.com/repos/dwarvesf/glod/pulls/comments/125598882"},"html":{"href":"https://github.com/dwarvesf/glod/pull/37#discussion_r125598882"},"pull_request":{"href":"https://api.github.com/repos/dwarvesf/glod/pulls/37"}}},"pull_request":{"url":"https://api.github.com/repos/dwarvesf/glod/pulls/37","id":128921931,"html_url":"https://github.com/dwarvesf/glod/pull/37","diff_url":"https://github.com/dwarvesf/glod/pull/37.diff","patch_url":"https://github.com/dwarvesf/glod/pull/37.patch","issue_url":"https://api.github.com/repos/dwarvesf/glod/issues/37","number":37,"state":"open","locked":false,"title":"refactor glod","user":{"login":"huynguyenh","id":23558573,"avatar_url":"https://avatars0.githubusercontent.com/u/23558573?v=3","gravatar_id":"","url":"https://api.github.com/users/huynguyenh","html_url":"https://github.com/huynguyenh","followers_url":"https://api.github.com/users/huynguyenh/followers","following_url":"https://api.github.com/users/huynguyenh/following{/other_user}","gists_url":"https://api.github.com/users/huynguyenh/gists{/gist_id}","starred_url":"https://api.github.com/users/huynguyenh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huynguyenh/subscriptions","organizations_url":"https://api.github.com/users/huynguyenh/orgs","repos_url":"https://api.github.com/users/huynguyenh/repos","events_url":"https://api.github.com/users/huynguyenh/events{/privacy}","received_events_url":"https://api.github.com/users/huynguyenh/received_events","type":"User","site_admin":false},"body":"#### Status\r\n\r\nREADY / IN DEVELOPMENT / HOLD\r\n\r\n#### What's this PR do?\r\n\r\n#### Where should the reviewer start?\r\n\r\n#### How should this be manually tested?\r\n\r\n#### Any background context you want to provide?\r\n\r\n#### What are the relevant Git tickets?\r\n\r\n#### Screenshots (if appropriate)\r\n\r\n#### Questions:\r\n\r\n- Is there a blog post?\r\n- Does the knowledge base need an update?\r\n- Does this add new dependencies which need to be added to?","created_at":"2017-07-05T09:43:55Z","updated_at":"2017-07-05T09:44:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"92181c8663690263f133cffbfebb6c3429b60485","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/dwarvesf/glod/pulls/37/commits","review_comments_url":"https://api.github.com/repos/dwarvesf/glod/pulls/37/comments","review_comment_url":"https://api.github.com/repos/dwarvesf/glod/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dwarvesf/glod/issues/37/comments","statuses_url":"https://api.github.com/repos/dwarvesf/glod/statuses/9d19a8c01a47bd19648d243123307de07edd796a","head":{"label":"dwarvesf:feature/refactor","ref":"feature/refactor","sha":"9d19a8c01a47bd19648d243123307de07edd796a","user":{"login":"dwarvesf","id":10388449,"avatar_url":"https://avatars2.githubusercontent.com/u/10388449?v=3","gravatar_id":"","url":"https://api.github.com/users/dwarvesf","html_url":"https://github.com/dwarvesf","followers_url":"https://api.github.com/users/dwarvesf/followers","following_url":"https://api.github.com/users/dwarvesf/following{/other_user}","gists_url":"https://api.github.com/users/dwarvesf/gists{/gist_id}","starred_url":"https://api.github.com/users/dwarvesf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwarvesf/subscriptions","organizations_url":"https://api.github.com/users/dwarvesf/orgs","repos_url":"https://api.github.com/users/dwarvesf/repos","events_url":"https://api.github.com/users/dwarvesf/events{/privacy}","received_events_url":"https://api.github.com/users/dwarvesf/received_events","type":"Organization","site_admin":false},"repo":{"id":41855638,"name":"glod","full_name":"dwarvesf/glod","owner":{"login":"dwarvesf","id":10388449,"avatar_url":"https://avatars2.githubusercontent.com/u/10388449?v=3","gravatar_id":"","url":"https://api.github.com/users/dwarvesf","html_url":"https://github.com/dwarvesf","followers_url":"https://api.github.com/users/dwarvesf/followers","following_url":"https://api.github.com/users/dwarvesf/following{/other_user}","gists_url":"https://api.github.com/users/dwarvesf/gists{/gist_id}","starred_url":"https://api.github.com/users/dwarvesf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwarvesf/subscriptions","organizations_url":"https://api.github.com/users/dwarvesf/orgs","repos_url":"https://api.github.com/users/dwarvesf/repos","events_url":"https://api.github.com/users/dwarvesf/events{/privacy}","received_events_url":"https://api.github.com/users/dwarvesf/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dwarvesf/glod","description":"Small library to help retrieve direct URL from multiple media sources that written in Go","fork":false,"url":"https://api.github.com/repos/dwarvesf/glod","forks_url":"https://api.github.com/repos/dwarvesf/glod/forks","keys_url":"https://api.github.com/repos/dwarvesf/glod/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dwarvesf/glod/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dwarvesf/glod/teams","hooks_url":"https://api.github.com/repos/dwarvesf/glod/hooks","issue_events_url":"https://api.github.com/repos/dwarvesf/glod/issues/events{/number}","events_url":"https://api.github.com/repos/dwarvesf/glod/events","assignees_url":"https://api.github.com/repos/dwarvesf/glod/assignees{/user}","branches_url":"https://api.github.com/repos/dwarvesf/glod/branches{/branch}","tags_url":"https://api.github.com/repos/dwarvesf/glod/tags","blobs_url":"https://api.github.com/repos/dwarvesf/glod/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dwarvesf/glod/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dwarvesf/glod/git/refs{/sha}","trees_url":"https://api.github.com/repos/dwarvesf/glod/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dwarvesf/glod/statuses/{sha}","languages_url":"https://api.github.com/repos/dwarvesf/glod/languages","stargazers_url":"https://api.github.com/repos/dwarvesf/glod/stargazers","contributors_url":"https://api.github.com/repos/dwarvesf/glod/contributors","subscribers_url":"https://api.github.com/repos/dwarvesf/glod/subscribers","subscription_url":"https://api.github.com/repos/dwarvesf/glod/subscription","commits_url":"https://api.github.com/repos/dwarvesf/glod/commits{/sha}","git_commits_url":"https://api.github.com/repos/dwarvesf/glod/git/commits{/sha}","comments_url":"https://api.github.com/repos/dwarvesf/glod/comments{/number}","issue_comment_url":"https://api.github.com/repos/dwarvesf/glod/issues/comments{/number}","contents_url":"https://api.github.com/repos/dwarvesf/glod/contents/{+path}","compare_url":"https://api.github.com/repos/dwarvesf/glod/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dwarvesf/glod/merges","archive_url":"https://api.github.com/repos/dwarvesf/glod/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dwarvesf/glod/downloads","issues_url":"https://api.github.com/repos/dwarvesf/glod/issues{/number}","pulls_url":"https://api.github.com/repos/dwarvesf/glod/pulls{/number}","milestones_url":"https://api.github.com/repos/dwarvesf/glod/milestones{/number}","notifications_url":"https://api.github.com/repos/dwarvesf/glod/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dwarvesf/glod/labels{/name}","releases_url":"https://api.github.com/repos/dwarvesf/glod/releases{/id}","deployments_url":"https://api.github.com/repos/dwarvesf/glod/deployments","created_at":"2015-09-03T11:11:06Z","updated_at":"2017-07-02T11:19:55Z","pushed_at":"2017-07-05T09:43:56Z","git_url":"git://github.com/dwarvesf/glod.git","ssh_url":"git@github.com:dwarvesf/glod.git","clone_url":"https://github.com/dwarvesf/glod.git","svn_url":"https://github.com/dwarvesf/glod","homepage":"https://github.com/dwarvesf/glod","size":59,"stargazers_count":39,"watchers_count":39,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":4,"forks":4,"open_issues":4,"watchers":39,"default_branch":"develop"}},"base":{"label":"dwarvesf:develop","ref":"develop","sha":"1d32b574f5576090332dc86b912b200190add55e","user":{"login":"dwarvesf","id":10388449,"avatar_url":"https://avatars2.githubusercontent.com/u/10388449?v=3","gravatar_id":"","url":"https://api.github.com/users/dwarvesf","html_url":"https://github.com/dwarvesf","followers_url":"https://api.github.com/users/dwarvesf/followers","following_url":"https://api.github.com/users/dwarvesf/following{/other_user}","gists_url":"https://api.github.com/users/dwarvesf/gists{/gist_id}","starred_url":"https://api.github.com/users/dwarvesf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwarvesf/subscriptions","organizations_url":"https://api.github.com/users/dwarvesf/orgs","repos_url":"https://api.github.com/users/dwarvesf/repos","events_url":"https://api.github.com/users/dwarvesf/events{/privacy}","received_events_url":"https://api.github.com/users/dwarvesf/received_events","type":"Organization","site_admin":false},"repo":{"id":41855638,"name":"glod","full_name":"dwarvesf/glod","owner":{"login":"dwarvesf","id":10388449,"avatar_url":"https://avatars2.githubusercontent.com/u/10388449?v=3","gravatar_id":"","url":"https://api.github.com/users/dwarvesf","html_url":"https://github.com/dwarvesf","followers_url":"https://api.github.com/users/dwarvesf/followers","following_url":"https://api.github.com/users/dwarvesf/following{/other_user}","gists_url":"https://api.github.com/users/dwarvesf/gists{/gist_id}","starred_url":"https://api.github.com/users/dwarvesf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwarvesf/subscriptions","organizations_url":"https://api.github.com/users/dwarvesf/orgs","repos_url":"https://api.github.com/users/dwarvesf/repos","events_url":"https://api.github.com/users/dwarvesf/events{/privacy}","received_events_url":"https://api.github.com/users/dwarvesf/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dwarvesf/glod","description":"Small library to help retrieve direct URL from multiple media sources that written in Go","fork":false,"url":"https://api.github.com/repos/dwarvesf/glod","forks_url":"https://api.github.com/repos/dwarvesf/glod/forks","keys_url":"https://api.github.com/repos/dwarvesf/glod/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dwarvesf/glod/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dwarvesf/glod/teams","hooks_url":"https://api.github.com/repos/dwarvesf/glod/hooks","issue_events_url":"https://api.github.com/repos/dwarvesf/glod/issues/events{/number}","events_url":"https://api.github.com/repos/dwarvesf/glod/events","assignees_url":"https://api.github.com/repos/dwarvesf/glod/assignees{/user}","branches_url":"https://api.github.com/repos/dwarvesf/glod/branches{/branch}","tags_url":"https://api.github.com/repos/dwarvesf/glod/tags","blobs_url":"https://api.github.com/repos/dwarvesf/glod/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dwarvesf/glod/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dwarvesf/glod/git/refs{/sha}","trees_url":"https://api.github.com/repos/dwarvesf/glod/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dwarvesf/glod/statuses/{sha}","languages_url":"https://api.github.com/repos/dwarvesf/glod/languages","stargazers_url":"https://api.github.com/repos/dwarvesf/glod/stargazers","contributors_url":"https://api.github.com/repos/dwarvesf/glod/contributors","subscribers_url":"https://api.github.com/repos/dwarvesf/glod/subscribers","subscription_url":"https://api.github.com/repos/dwarvesf/glod/subscription","commits_url":"https://api.github.com/repos/dwarvesf/glod/commits{/sha}","git_commits_url":"https://api.github.com/repos/dwarvesf/glod/git/commits{/sha}","comments_url":"https://api.github.com/repos/dwarvesf/glod/comments{/number}","issue_comment_url":"https://api.github.com/repos/dwarvesf/glod/issues/comments{/number}","contents_url":"https://api.github.com/repos/dwarvesf/glod/contents/{+path}","compare_url":"https://api.github.com/repos/dwarvesf/glod/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dwarvesf/glod/merges","archive_url":"https://api.github.com/repos/dwarvesf/glod/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dwarvesf/glod/downloads","issues_url":"https://api.github.com/repos/dwarvesf/glod/issues{/number}","pulls_url":"https://api.github.com/repos/dwarvesf/glod/pulls{/number}","milestones_url":"https://api.github.com/repos/dwarvesf/glod/milestones{/number}","notifications_url":"https://api.github.com/repos/dwarvesf/glod/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dwarvesf/glod/labels{/name}","releases_url":"https://api.github.com/repos/dwarvesf/glod/releases{/id}","deployments_url":"https://api.github.com/repos/dwarvesf/glod/deployments","created_at":"2015-09-03T11:11:06Z","updated_at":"2017-07-02T11:19:55Z","pushed_at":"2017-07-05T09:43:56Z","git_url":"git://github.com/dwarvesf/glod.git","ssh_url":"git@github.com:dwarvesf/glod.git","clone_url":"https://github.com/dwarvesf/glod.git","svn_url":"https://github.com/dwarvesf/glod","homepage":"https://github.com/dwarvesf/glod","size":59,"stargazers_count":39,"watchers_count":39,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":4,"forks":4,"open_issues":4,"watchers":39,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/dwarvesf/glod/pulls/37"},"html":{"href":"https://github.com/dwarvesf/glod/pull/37"},"issue":{"href":"https://api.github.com/repos/dwarvesf/glod/issues/37"},"comments":{"href":"https://api.github.com/repos/dwarvesf/glod/issues/37/comments"},"review_comments":{"href":"https://api.github.com/repos/dwarvesf/glod/pulls/37/comments"},"review_comment":{"href":"https://api.github.com/repos/dwarvesf/glod/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dwarvesf/glod/pulls/37/commits"},"statuses":{"href":"https://api.github.com/repos/dwarvesf/glod/statuses/9d19a8c01a47bd19648d243123307de07edd796a"}}}}
{"actor":{"display_login":"houndci-bot"}}