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