Module: Yourub::Reader
- Defined in:
- lib/yourub/reader.rb
Class Method Summary collapse
Class Method Details
.parse_entry(entry) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/yourub/reader.rb', line 10 def parse_entry(entry) video_id = entry["id"]["videoId"] || entry['id'] { 'id' => video_id, 'title' => entry['snippet']['title'], 'thumb' => entry['snippet']['thumbnails']['default']['url'], 'url' => 'https://www.youtube.com/watch?v='<< video_id } end |
.parse_videos(videos) ⇒ Object
4 5 6 7 8 |
# File 'lib/yourub/reader.rb', line 4 def parse_videos(videos) res = JSON.parse(videos.data.to_json)['items'] return nil if res.empty? res end |