]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/videomore.py
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',
90 return mobj.group('url
')
92 def _real_extract(self, url):
93 mobj = re.match(self._VALID_URL, url)
94 video_id = mobj.group('sid
') or mobj.group('id')
96 video = self._download_xml(
97 'http
://videomore
.ru
/video
/tracks
/%s.xml
' % video_id,
98 video_id, 'Downloading video XML
')
100 item = xpath_element(video, './/playlist
/item
', fatal=True)
103 item, ('./title
', './episode_name
'), 'title
', fatal=True)
105 video_url = xpath_text(item, './video_url
', 'video url
', fatal=True)
106 formats = self._extract_f4m_formats(video_url, video_id, f4m_id='hds
')
107 self._sort_formats(formats)
109 thumbnail = xpath_text(item, './thumbnail_url
')
110 duration = int_or_none(xpath_text(item, './duration
'))
111 view_count = int_or_none(xpath_text(item, './views
'))
112 comment_count = int_or_none(xpath_text(item, './count_comments
'))
113 age_limit = int_or_none(xpath_text(item, './min_age
'))
115 series = xpath_text(item, './project_name
')
116 episode = xpath_text(item, './episode_name
')
123 'thumbnail
': thumbnail,
124 'duration
': duration,
125 'view_count
': view_count,
126 'comment_count
': comment_count,
127 'age_limit
': age_limit,
132 class VideomoreVideoIE(InfoExtractor):
133 IE_NAME = 'videomore
:video
'
134 _VALID_URL = r'https?
://videomore\
.ru
/(?
:(?
:[^
/]+/){2}
)?
(?P
<id>[^
/?
#&]+)[/?#&]*$'
136 # single video with og:video:iframe
137 'url': 'http://videomore.ru/elki_3',
143 'thumbnail': 're:^https?://.*\.jpg',
149 'skip_download': True,
152 # season single series with og:video:iframe
153 'url': 'http://videomore.ru/poslednii_ment/1_sezon/14_seriya',
154 'only_matching': True,
156 'url': 'http://videomore.ru/sejchas_v_seti/serii_221-240/226_vypusk',
157 'only_matching': True,
159 # single video without og:video:iframe
160 'url': 'http://videomore.ru/marin_i_ego_druzya',
164 'title': '1 серия. Здравствуй, Аквавилль!',
165 'description': 'md5:c6003179538b5d353e7bcd5b1372b2d7',
166 'thumbnail': 're:^https?://.*\.jpg',
172 'skip_download': True,
177 def suitable(cls
, url
):
178 return False if VideomoreIE
.suitable(url
) else super(VideomoreVideoIE
, cls
).suitable(url
)
180 def _real_extract(self
, url
):
181 display_id
= self
._match
_id
(url
)
183 webpage
= self
._download
_webpage
(url
, display_id
)
185 video_url
= self
._og
_search
_property
(
186 'video:iframe', webpage
, 'video url', default
=None)
189 video_id
= self
._search
_regex
(
190 (r
'config\s*:\s*["\']https?
://videomore\
.ru
/video
/tracks
/(\d
+)\
.xml
',
191 r'track
-id=["\'](\d+)',
192 r'xcnt_product_id\s*=\s*(\d+)'), webpage, 'video id')
193 video_url = 'videomore:%s' % video_id
195 return self.url_result(video_url, VideomoreIE.ie_key())
198 class VideomoreSeasonIE(InfoExtractor):
199 IE_NAME = 'videomore:season'
200 _VALID_URL = r'https?://videomore\.ru/(?!embed)(?P<id>[^/]+/[^/?#&]+)[/?#&]*$'
202 'url': 'http://videomore.ru/molodezhka/sezon_promo',
204 'id': 'molodezhka/sezon_promo',
205 'title': 'Молодежка Промо',
207 'playlist_mincount': 12,
210 def _real_extract(self, url):
211 display_id = self._match_id(url)
213 webpage = self._download_webpage(url, display_id)
215 title = self._og_search_title(webpage)
218 self.url_result(item) for item in re.findall(
219 r'<a[^>]+href="((?
:https?
:)?
//videomore\
.ru
/%s/[^
/]+)"[^>]+class="widget
-item
-desc
"'
220 % display_id, webpage)]
222 return self.playlist_result(entries, display_id, title)