]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/videomore.py
7f25665864c696757903deeb582a64f16eec0d85
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
14 class VideomoreIE(InfoExtractor
):
16 _VALID_URL
= r
'videomore:(?P<sid>\d+)$|https?://videomore\.ru/(?:(?:embed|[^/]+/[^/]+)/|[^/]+\?.*\btrack_id=)(?P<id>\d+)(?:[/?#&]|\.(?:xml|json)|$)'
18 'url': 'http://videomore.ru/kino_v_detalayah/5_sezon/367617',
19 'md5': '44455a346edc0d509ac5b5a5b531dc35',
23 'title': 'Кино в деталях 5 сезон В гостях Алексей Чумаков и Юлия Ковальчук',
24 'series': 'Кино в деталях',
25 'episode': 'В гостях Алексей Чумаков и Юлия Ковальчук',
26 'thumbnail': 're:^https?://.*\.jpg',
33 'url': 'http://videomore.ru/embed/259974',
37 'title': 'Молодежка 2 сезон 40 серия',
38 'series': 'Молодежка',
39 'episode': '40 серия',
40 'thumbnail': 're:^https?://.*\.jpg',
47 'skip_download': True,
50 'url': 'http://videomore.ru/molodezhka/sezon_promo/341073',
54 'title': 'Промо Команда проиграла из-за Бакина?',
55 'episode': 'Команда проиграла из-за Бакина?',
56 'thumbnail': 're:^https?://.*\.jpg',
62 'skip_download': True,
65 'url': 'http://videomore.ru/elki_3?track_id=364623',
66 'only_matching': True,
68 'url': 'http://videomore.ru/embed/364623',
69 'only_matching': True,
71 'url': 'http://videomore.ru/video/tracks/364623.xml',
72 'only_matching': True,
74 'url': 'http://videomore.ru/video/tracks/364623.json',
75 'only_matching': True,
77 'url': 'http://videomore.ru/video/tracks/158031/quotes/33248',
78 'only_matching': True,
80 'url': 'videomore:367617',
81 'only_matching': True,
85 def _extract_url(webpage
):
87 r
'<object[^>]+data=(["\'])https?
://videomore\
.ru
/player\
.swf
\?.*config
=(?P
<url
>https?
://videomore\
.ru
/(?
:[^
/]+/)+\d
+\
.xml
).*\
1',
91 r'<iframe
[^
>]+src
=([\'"])(?P<url>https?://videomore\.ru/embed/\d+)',
95 return mobj.group('url')
97 def _real_extract(self, url):
98 mobj = re.match(self._VALID_URL, url)
99 video_id = mobj.group('sid') or mobj.group('id')
101 video = self._download_xml(
102 'http://videomore.ru/video/tracks/%s.xml' % video_id,
103 video_id, 'Downloading video XML')
105 item = xpath_element(video, './/playlist/item', fatal=True)
108 item, ('./title', './episode_name'), 'title', fatal=True)
110 video_url = xpath_text(item, './video_url', 'video url', fatal=True)
111 formats = self._extract_f4m_formats(video_url, video_id, f4m_id='hds')
112 self._sort_formats(formats)
114 thumbnail = xpath_text(item, './thumbnail_url')
115 duration = int_or_none(xpath_text(item, './duration'))
116 view_count = int_or_none(xpath_text(item, './views'))
117 comment_count = int_or_none(xpath_text(item, './count_comments'))
118 age_limit = int_or_none(xpath_text(item, './min_age'))
120 series = xpath_text(item, './project_name')
121 episode = xpath_text(item, './episode_name')
128 'thumbnail': thumbnail,
129 'duration': duration,
130 'view_count': view_count,
131 'comment_count': comment_count,
132 'age_limit': age_limit,
137 class VideomoreVideoIE(InfoExtractor):
138 IE_NAME = 'videomore:video'
139 _VALID_URL = r'https?://videomore\.ru/(?:(?:[^/]+/){2})?(?P<id>[^/?#&]+)[/?#&]*$'
141 # single video with og:video:iframe
142 'url': 'http://videomore.ru/elki_3',
148 'thumbnail': 're:^https?://.*\.jpg',
154 'skip_download': True,
157 # season single series with og:video:iframe
158 'url': 'http://videomore.ru/poslednii_ment/1_sezon/14_seriya',
159 'only_matching': True,
161 'url': 'http://videomore.ru/sejchas_v_seti/serii_221-240/226_vypusk',
162 'only_matching': True,
164 # single video without og:video:iframe
165 'url': 'http://videomore.ru/marin_i_ego_druzya',
169 'title': '1 серия. Здравствуй, Аквавилль!',
170 'description': 'md5:c6003179538b5d353e7bcd5b1372b2d7',
171 'thumbnail': 're:^https?://.*\.jpg',
177 'skip_download': True,
182 def suitable(cls, url):
183 return False if VideomoreIE.suitable(url) else super(VideomoreVideoIE, cls).suitable(url)
185 def _real_extract(self, url):
186 display_id = self._match_id(url)
188 webpage = self._download_webpage(url, display_id)
190 video_url = self._og_search_property(
191 'video:iframe', webpage, 'video url', default=None)
194 video_id = self._search_regex(
195 (r'config\s*:\s*["\']https?
://videomore\
.ru
/video
/tracks
/(\d
+)\
.xml
',
196 r'track
-id=["\'](\d+)',
197 r'xcnt_product_id\s*=\s*(\d+)'), webpage, 'video id')
198 video_url = 'videomore:%s' % video_id
200 return self.url_result(video_url, VideomoreIE.ie_key())
203 class VideomoreSeasonIE(InfoExtractor):
204 IE_NAME = 'videomore:season'
205 _VALID_URL = r'https?://videomore\.ru/(?!embed)(?P<id>[^/]+/[^/?#&]+)[/?#&]*$'
207 'url': 'http://videomore.ru/molodezhka/sezon_promo',
209 'id': 'molodezhka/sezon_promo',
210 'title': 'Молодежка Промо',
212 'playlist_mincount': 12,
215 def _real_extract(self, url):
216 display_id = self._match_id(url)
218 webpage = self._download_webpage(url, display_id)
220 title = self._og_search_title(webpage)
223 self.url_result(item) for item in re.findall(
224 r'<a[^>]+href="((?
:https?
:)?
//videomore\
.ru
/%s/[^
/]+)"[^>]+class="widget
-item
-desc
"'
225 % display_id, webpage)]
227 return self.playlist_result(entries, display_id, title)