From b5f363c294f0cad3160645d3d8354c279e20d868 Mon Sep 17 00:00:00 2001 From: sichuan-pepper <43799410+sichuan-pepper@users.noreply.github.com> Date: Thu, 11 Oct 2018 22:19:59 +0900 Subject: [PATCH 1/3] [Chuun] Add new extractor --- youtube_dl/extractor/chuun.py | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 youtube_dl/extractor/chuun.py diff --git a/youtube_dl/extractor/chuun.py b/youtube_dl/extractor/chuun.py new file mode 100644 index 000000000..c4d79c926 --- /dev/null +++ b/youtube_dl/extractor/chuun.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from .common import InfoExtractor + +import re + + +class ChuunIE(InfoExtractor): + _VALID_URL = r'https://chuun\.ctv\.co\.jp/player/(?P[0-9]+)' + _TEST = { + 'url': 'https://chuun.ctv.co.jp/player/1', + 'md5': '964452757b7c2ae1dd35e019068a3fae', + 'info_dict': { + 'id': '1', + 'ext': 'mp4', + 'title': '#0 中京テレビ放送 初来社 2015年8月23日配信分', + 'description': "太田上田 #0 中京テレビ放送 初来社 2015年8月23日配信分", + 'thumbnail': r're:^https?://.+\.(jpg|png)$', + } + } + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + video_id = mobj.group('video_id') + webpage = self._download_webpage(url, video_id) + m3u8_url = re.findall(r"'movieAccessUrl':'(http[^']+)'", webpage)[0] + title = self._og_search_title(webpage) or self._html_search_regex(r'(.+)', webpage, 'page_title') + description = self._html_search_meta('description', webpage) + thumbnail = self._og_search_thumbnail(webpage)\ + or self._html_search_regex(r"'programThumbnailUrlLarge':'(http[^']+)'", webpage, 'large_thumbnail')\ + or self._html_search_regex(r"'programThumbnailUrl':'(http[^']+)'", webpage, 'medium_thumbnail')\ + or self._html_search_regex(r"'programThumbnailUrlSmall':'(http[^']+)'", webpage, 'small_thumbnail') + formats = self._extract_m3u8_formats(m3u8_url, video_id, ext='mp4') + self._sort_formats(formats) + return { + 'id': video_id, + 'url': url, + 'title': title, + 'description': description, + 'thumbnail': thumbnail, + 'formats': formats, + } From ee4da5a39a2ba0103e205b068369fc76059fb872 Mon Sep 17 00:00:00 2001 From: sichuan-pepper Date: Thu, 8 Nov 2018 02:31:12 +0900 Subject: [PATCH 2/3] [Chuun] Add an import --- youtube_dl/extractor/extractors.py | 1 + 1 file changed, 1 insertion(+) diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 17b576df3..822ec74d6 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -197,6 +197,7 @@ from .chirbit import ( ChirbitIE, ChirbitProfileIE, ) +from .chuun import ChuunIE from .cinchcast import CinchcastIE from .cjsw import CJSWIE from .cliphunter import CliphunterIE From 2d46eb76000ce231111f0ad3d1c7c4a1f1dc353a Mon Sep 17 00:00:00 2001 From: sichuan-pepper Date: Fri, 9 Nov 2018 16:07:30 +0900 Subject: [PATCH 3/3] [Chunun]changed MD5 checksum in test data --- youtube_dl/extractor/chuun.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/youtube_dl/extractor/chuun.py b/youtube_dl/extractor/chuun.py index c4d79c926..3e69857bf 100644 --- a/youtube_dl/extractor/chuun.py +++ b/youtube_dl/extractor/chuun.py @@ -7,10 +7,10 @@ import re class ChuunIE(InfoExtractor): - _VALID_URL = r'https://chuun\.ctv\.co\.jp/player/(?P[0-9]+)' + _VALID_URL = r'https://chuun\.ctv\.co\.jp/player/(?P\d+)' _TEST = { 'url': 'https://chuun.ctv.co.jp/player/1', - 'md5': '964452757b7c2ae1dd35e019068a3fae', + 'md5': 'c989576b6b492df1eed57b5de290df23', 'info_dict': { 'id': '1', 'ext': 'mp4', @@ -22,10 +22,10 @@ class ChuunIE(InfoExtractor): def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) - video_id = mobj.group('video_id') + video_id = mobj.group('id') webpage = self._download_webpage(url, video_id) m3u8_url = re.findall(r"'movieAccessUrl':'(http[^']+)'", webpage)[0] - title = self._og_search_title(webpage) or self._html_search_regex(r'(.+)', webpage, 'page_title') + title = self._og_search_title(webpage) or self._html_search_regex(r'(.+)', webpage, 'title') description = self._html_search_meta('description', webpage) thumbnail = self._og_search_thumbnail(webpage)\ or self._html_search_regex(r"'programThumbnailUrlLarge':'(http[^']+)'", webpage, 'large_thumbnail')\