Skip to content

Commit

Permalink
Merge pull request #127 from vheuken/typlaylist-author
Browse files Browse the repository at this point in the history
Added specs for author-info for Youtube Playlists
  • Loading branch information
Vincent Heuken committed Mar 10, 2016
2 parents e8b4ade + 2b38836 commit 2f520d9
Show file tree
Hide file tree
Showing 8 changed files with 8,607 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ playlist = VideoInfo.new("http://www.youtube.com/playlist?p=PL9hW1uS6HUftLdHI6RI
# playlist.playlist_id => 'PL9hW1uS6HUftLdHI6RIsaf'
# playlist.provider => 'YouTube'
# playlist.title => 'YouTube Policy and Copyright'
# playlist.author => 'YouTube Help'
# playlist.author_thumbnail => 'https://yt3.ggpht.com/-ni_VaN38-AE/AAAAAAAAAAI/AAAAAAAAAAA/bJCTTfihBl0/s100-c-k-no/photo.jpg'
# playlist.author_url => 'https://www.youtube.com/user/YouTubeHelp'
# playlist.thumbnail_small => 'http://i.ytimg.com/vi/8b0aEoxqqC0/default.jpg'
# playlist.thumbnail_medium => 'http://i.ytimg.com/vi/8b0aEoxqqC0/mqdefault.jpg'
# playlist.thumbnail_large => 'http://i.ytimg.com/vi/8b0aEoxqqC0/hqdefault.jpg'
Expand Down
13 changes: 13 additions & 0 deletions lib/video_info/providers/youtubeplaylist_scraper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@ def keywords
nil
end

def author
data.css('.channel-header-profile-image').attr('title')[0].value
end

def author_thumbnail
data.css('.channel-header-profile-image').attr('src')[0].value
end

def author_url
element = data.css('.channel-header-profile-image-container')
'https://www.youtube.com' + element.attr('href')[0].value
end

def videos
raise(NotImplementedError,
'To access videos, you must provide an API key ' \
Expand Down

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2f520d9

Please sign in to comment.