]>
Commit | Line | Data |
---|---|---|
a42dfa62 | 1 | # coding: utf-8 |
2 | from __future__ import unicode_literals | |
3 | ||
4 | import re | |
5 | ||
6 | from .common import InfoExtractor | |
7 | ||
8 | ||
1306f5ed RA |
9 | class MyChannelsIE(InfoExtractor): |
10 | _VALID_URL = r'https?://(?:www\.)?mychannels\.com/.*(?P<id_type>video|production)_id=(?P<id>[0-9]+)' | |
a42dfa62 | 11 | _TEST = { |
1306f5ed RA |
12 | 'url': 'https://mychannels.com/missholland/miss-holland?production_id=3416', |
13 | 'md5': 'b8993daad4262dd68d89d651c0c52c45', | |
a42dfa62 | 14 | 'info_dict': { |
1306f5ed | 15 | 'id': 'wUUDZZep6vQD', |
a42dfa62 | 16 | 'ext': 'mp4', |
1306f5ed RA |
17 | 'title': 'Miss Holland joins VOTE LEAVE', |
18 | 'description': 'Miss Holland | #13 Not a potato', | |
19 | 'uploader': 'Miss Holland', | |
a42dfa62 | 20 | } |
21 | } | |
22 | ||
23 | def _real_extract(self, url): | |
24 | id_type, url_id = re.match(self._VALID_URL, url).groups() | |
25 | webpage = self._download_webpage(url, url_id) | |
26 | video_data = self._html_search_regex(r'<div([^>]+data-%s-id="%s"[^>]+)>' % (id_type, url_id), webpage, 'video data') | |
27 | ||
28 | def extract_data_val(attr, fatal=False): | |
29 | return self._html_search_regex(r'data-%s\s*=\s*"([^"]+)"' % attr, video_data, attr, fatal=fatal) | |
1306f5ed | 30 | minoto_id = extract_data_val('minoto-id') or self._search_regex(r'/id/([a-zA-Z0-9]+)', extract_data_val('video-src', True), 'minoto id') |
a42dfa62 | 31 | |
32 | return { | |
33 | '_type': 'url_transparent', | |
34 | 'url': 'minoto:%s' % minoto_id, | |
1306f5ed | 35 | 'id': url_id, |
a42dfa62 | 36 | 'title': extract_data_val('title', True), |
37 | 'description': extract_data_val('description'), | |
38 | 'thumbnail': extract_data_val('image'), | |
39 | 'uploader': extract_data_val('channel'), | |
40 | } |