Skip to content
This repository has been archived by the owner on Aug 12, 2020. It is now read-only.

Commit

Permalink
Add more URL parameters and add another test case
Browse files Browse the repository at this point in the history
  • Loading branch information
corny committed Jul 22, 2020
1 parent 75b13b9 commit 129ec11
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion video_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func extractVideoID(u *url.URL) string {

// GetVideoInfoFromID fetches video info from a youtube video id
func (c *Client) GetVideoInfoFromID(cx context.Context, id string) (*VideoInfo, error) {
body, err := c.httpGetAndCheckResponseReadBody(cx, youtubeBaseURL+"?v="+id)
body, err := c.httpGetAndCheckResponseReadBody(cx, youtubeBaseURL+"?v="+id+"&gl=US&hl=en&has_verified=1&bpctr=9999999999")

if err != nil {
return nil, err
Expand Down
9 changes: 9 additions & 0 deletions video_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ func TestVideoInfo(t *testing.T) {
published: newDate(2013, 7, 3),
description: "Executive Producer: Jeff Nicholas \nProduced by Jonathan Craven and Nathan Scherrer \nDirected by Jonathan Craven, Simon McLoughlin and Jeff Nicholas for The Uprising Creative (http://theuprisingcreative.com) \nDirector Of Photography: Sing Howe Yam \nEditor: Jacqueline London\n\nOfficial music video by Justin Timberlake performing Tunnel Vision (Explicit). (C) 2013 RCA Records, a division of Sony Music Entertainment\n\n#JustinTimberlake #TunnelVision #Vevo #Pop #OfficialMuiscVideo",
},
// Controversy video
{
videoID: "T4XJQO3qol8",
title: `Burning Everyone's Koran`,
uploader: "Amazing Atheist",
duration: time.Second * 219,
published: newDate(2010, 9, 9),
description: "SUBSCRIBE: http://www.youtube.com/saturninefilms \r\n\r\nEven Obama has taken a stand against freedom on this issue: http://www.huffingtonpost.com/2010/09...",
},
{
videoID: "qHGTs1NSB1s",
title: "Why Linus Torvalds doesn't use Ubuntu or Debian",
Expand Down

0 comments on commit 129ec11

Please sign in to comment.