]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/toongoggles.py
2 from __future__
import unicode_literals
5 from .common
import InfoExtractor
12 class ToonGogglesIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:www\.)?toongoggles\.com/shows/(?P<show_id>\d+)(?:/[^/]+/episodes/(?P<episode_id>\d+))?'
15 'url': 'http://www.toongoggles.com/shows/217143/bernard-season-2/episodes/217147/football',
16 'md5': '18289fc2b951eff6b953a9d8f01e6831',
22 'description': 'Bernard decides to play football in order to be better than Lloyd and tries to beat him no matter how, he even cheats.',
23 'upload_date': '20160718',
24 'timestamp': 1468879330,
27 'url': 'http://www.toongoggles.com/shows/227759/om-nom-stories-around-the-world',
30 'title': 'Om Nom Stories Around The World',
32 'playlist_mincount': 11,
35 def _call_api(self
, action
, page_id
, query
):
42 return self
._download
_json
('http://api.toongoggles.com/' + action
, page_id
, query
=query
)
44 def _parse_episode_data(self
, episode_data
):
45 title
= episode_data
['episode_name']
48 '_type': 'url_transparent',
49 'id': episode_data
['episode_id'],
51 'url': 'kaltura:513551:' + episode_data
['entry_id'],
52 'thumbnail': episode_data
.get('thumbnail_url'),
53 'description': episode_data
.get('description'),
54 'duration': parse_duration(episode_data
.get('hms')),
55 'series': episode_data
.get('show_name'),
56 'season_number': int_or_none(episode_data
.get('season_num')),
57 'episode_id': episode_data
.get('episode_id'),
59 'episode_number': int_or_none(episode_data
.get('episode_num')),
60 'categories': episode_data
.get('categories'),
64 def _real_extract(self
, url
):
65 show_id
, episode_id
= self
._match
_valid
_url
(url
).groups()
67 episode_data
= self
._call
_api
('search', episode_id
, {
71 return self
._parse
_episode
_data
(episode_data
)
73 show_data
= self
._call
_api
('getepisodesbyshow', show_id
, {
78 for episode_data
in show_data
.get('objects', []):
79 entries
.append(self
._parse
_episode
_data
(episode_data
))
80 return self
.playlist_result(entries
, show_id
, show_data
.get('show_name'))