From f240f46f7c058fe253d6859b25cb15e78ba587e2 Mon Sep 17 00:00:00 2001 From: SpiderRider067 Date: Fri, 15 Jan 2021 16:41:28 -0500 Subject: [PATCH 1/3] [RCTIplus] Add new extractor --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/rcti.py | 40 ++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 youtube_dl/extractor/rcti.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 57d4d319c..a91a93da1 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -960,6 +960,7 @@ from .raywenderlich import ( RayWenderlichCourseIE, ) from .rbmaradio import RBMARadioIE +from .rcti import RCTIplusIE from .rds import RDSIE from .redbulltv import ( RedBullTVIE, diff --git a/youtube_dl/extractor/rcti.py b/youtube_dl/extractor/rcti.py new file mode 100644 index 000000000..26f9e9d79 --- /dev/null +++ b/youtube_dl/extractor/rcti.py @@ -0,0 +1,40 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + + +class RCTIplusIE(InfoExtractor): + IE_NAME = 'RCTIplus' + _VALID_URL = r'https://www\.rctiplus\.com/programs/\d+?/.*?/episode/(?P\d+)/.*' + _TEST = { + 'url': 'https://www.rctiplus.com/programs/540/upin-ipin/episode/5642/esok-puasa-upin-ipin-ep1', + 'md5': 'e9b7c88101aab04d9115e2718dae7260', + 'info_dict': { + 'id': '5642', + 'title': 'Esok Puasa - Upin & Ipin Ep.1', + 'ext': 'm3u8', + } + } + + def _real_extract(self, url): + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) + title = self._og_search_title(webpage) + + auth_key = self._search_regex( + r'\'Authorization\':"(?P[^"]+)"', webpage, 'auth-key') + request_url = ('https://api.rctiplus.com/api/v1/episode/' + video_id + + '/url?appierid=.1') + json = self._download_json( + request_url, video_id, headers={'Authorization': auth_key}) + video_url = json.get('data').get('url') + + formats = self._extract_m3u8_formats(video_url, video_id) + self._sort_formats(formats) + + return { + 'id': video_id, + 'title': title, + 'formats': formats, + } From 594eb9f72f3c6e94cfbbb316b6cb6162702609e3 Mon Sep 17 00:00:00 2001 From: SpiderRider067 <36859584+SpiderRider067@users.noreply.github.com> Date: Mon, 18 Jan 2021 14:17:05 -0500 Subject: [PATCH 2/3] add `params` entry to _TEST to make it pass --- youtube_dl/extractor/rcti.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/rcti.py b/youtube_dl/extractor/rcti.py index 26f9e9d79..6e890162c 100644 --- a/youtube_dl/extractor/rcti.py +++ b/youtube_dl/extractor/rcti.py @@ -14,7 +14,10 @@ class RCTIplusIE(InfoExtractor): 'id': '5642', 'title': 'Esok Puasa - Upin & Ipin Ep.1', 'ext': 'm3u8', - } + }, + 'params': { + 'format': 'bestvideo, bestaudio', + }, } def _real_extract(self, url): From fe693c15122e0efcdf0806032bc4818e06663254 Mon Sep 17 00:00:00 2001 From: SpiderRider067 <36859584+SpiderRider067@users.noreply.github.com> Date: Mon, 18 Jan 2021 14:30:47 -0500 Subject: [PATCH 3/3] Update rcti.py --- youtube_dl/extractor/rcti.py | 1 - 1 file changed, 1 deletion(-) diff --git a/youtube_dl/extractor/rcti.py b/youtube_dl/extractor/rcti.py index 6e890162c..f79cab9a3 100644 --- a/youtube_dl/extractor/rcti.py +++ b/youtube_dl/extractor/rcti.py @@ -5,7 +5,6 @@ from .common import InfoExtractor class RCTIplusIE(InfoExtractor): - IE_NAME = 'RCTIplus' _VALID_URL = r'https://www\.rctiplus\.com/programs/\d+?/.*?/episode/(?P\d+)/.*' _TEST = { 'url': 'https://www.rctiplus.com/programs/540/upin-ipin/episode/5642/esok-puasa-upin-ipin-ep1',