aboutsummaryrefslogtreecommitdiffhomepage
path: root/youtube_dl/extractor/mychannels.py
diff options
context:
space:
mode:
authorRemita Amine <[email protected]>2018-05-16 19:11:48 +0100
committerRemita Amine <[email protected]>2018-05-16 19:11:48 +0100
commit1306f5ed726b9f8778a5cc0586436b555f64c2ff (patch)
tree568ab16df7b81f3af572f499f6e1d4cc4604af96 /youtube_dl/extractor/mychannels.py
parent58a68d8fdae5358273ee52d05d77fe42094e128e (diff)
downloadyoutube-dl-1306f5ed726b9f8778a5cc0586436b555f64c2ff.tar.gz
youtube-dl-1306f5ed726b9f8778a5cc0586436b555f64c2ff.zip
[mychannels] add support for mychannels.com(closes #15334)
Diffstat (limited to 'youtube_dl/extractor/mychannels.py')
-rw-r--r--youtube_dl/extractor/mychannels.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/youtube_dl/extractor/mychannels.py b/youtube_dl/extractor/mychannels.py
new file mode 100644
index 000000000..b1ffe7848
--- /dev/null
+++ b/youtube_dl/extractor/mychannels.py
@@ -0,0 +1,40 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+
+
+class MyChannelsIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?mychannels\.com/.*(?P<id_type>video|production)_id=(?P<id>[0-9]+)'
+ _TEST = {
+ 'url': 'https://mychannels.com/missholland/miss-holland?production_id=3416',
+ 'md5': 'b8993daad4262dd68d89d651c0c52c45',
+ 'info_dict': {
+ 'id': 'wUUDZZep6vQD',
+ 'ext': 'mp4',
+ 'title': 'Miss Holland joins VOTE LEAVE',
+ 'description': 'Miss Holland | #13 Not a potato',
+ 'uploader': 'Miss Holland',
+ }
+ }
+
+ def _real_extract(self, url):
+ id_type, url_id = re.match(self._VALID_URL, url).groups()
+ webpage = self._download_webpage(url, url_id)
+ video_data = self._html_search_regex(r'<div([^>]+data-%s-id="%s"[^>]+)>' % (id_type, url_id), webpage, 'video data')
+
+ def extract_data_val(attr, fatal=False):
+ return self._html_search_regex(r'data-%s\s*=\s*"([^"]+)"' % attr, video_data, attr, fatal=fatal)
+ 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')
+
+ return {
+ '_type': 'url_transparent',
+ 'url': 'minoto:%s' % minoto_id,
+ 'id': url_id,
+ 'title': extract_data_val('title', True),
+ 'description': extract_data_val('description'),
+ 'thumbnail': extract_data_val('image'),
+ 'uploader': extract_data_val('channel'),
+ }