Module: Yourub::Reader

Defined in:
lib/yourub/reader.rb

Class Method Summary collapse

Class Method Details

.parse_entry(entry) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/yourub/reader.rb', line 8

def parse_entry(entry)
  video_id = entry["id"]["videoId"] || entry['id']
  founded_video = {
     '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
# File 'lib/yourub/reader.rb', line 4

def parse_videos(videos)
  JSON.parse(videos.data.to_json)['items']
end