From 7d95750be90b015e0674ff1531c57f7c29198eaf Mon Sep 17 00:00:00 2001 From: James Andariese Date: Tue, 17 Mar 2020 21:28:53 -0700 Subject: [PATCH 1/3] added myrunninfman.com support (fembed only, so far) --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/myrunningman.py | 131 +++++++++++++++++++++++++++ 2 files changed, 132 insertions(+) create mode 100644 youtube_dl/extractor/myrunningman.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 64d1fa251..fec6ad66f 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -657,6 +657,7 @@ from .mtv import ( from .muenchentv import MuenchenTVIE from .mwave import MwaveIE, MwaveMeetGreetIE from .mychannels import MyChannelsIE +from .myrunningman import MyRunningManIE from .myspace import MySpaceIE, MySpaceAlbumIE from .myspass import MySpassIE from .myvi import ( diff --git a/youtube_dl/extractor/myrunningman.py b/youtube_dl/extractor/myrunningman.py new file mode 100644 index 000000000..ec6a1b255 --- /dev/null +++ b/youtube_dl/extractor/myrunningman.py @@ -0,0 +1,131 @@ +from pprint import pprint +from .common import InfoExtractor + +LABEL_SIZES={ + '480p': {"width":640, "height": 480}, + '480i': {"width":640, "height": 480}, + '720p': {"width":1280, "height": 720}, + '720i': {"width":1280, "height": 720}, + '1080p': {"width":1920, "height": 1080}, + '1080i': {"width":1920, "height": 1080}, + '1440p': {"width":2560, "height": 1440}, + '1440i': {"width":2560, "height": 1440}, + '4K': {"width":3840, "height": 2160}, + '2160p': {"width":3840, "height": 2160}, + '2160i': {"width":3840, "height": 2160}, + '8K': {"width":7680, "height": 4320}, + '4320p': {"width":7680, "height": 4320}, + '4320i': {"width":7680, "height": 4320}, +} + +class MyRunningManIE(InfoExtractor): + _VALID_URL = r'(?:https?://)?(?:www\.)?myrunningman\.com/ep/(?P[0-9]+)$' + + def _real_extract(self, url): + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) + data_url = self._html_search_regex(r'data-url="f([^"]+)"', webpage, "data-url") + pprint('https://feurl.com/api/source/{}'.format(data_url)) + source = self._download_json('https://feurl.com/api/source/{}'.format(data_url),video_id, data='r=https%3A%2F%2Fwww.myrunningman.com%2Fcache%2Fstream%2Ff{}.html&d=feurl.com'.format(data_url).encode('utf-8')) + assert source['success'] + + formats = [] + for d in source['data']: + formats.append(dict({ + 'ext': d['type'], + 'url': d['file'], + }, **LABEL_SIZES.get(d['label'], {}))) + pprint(LABEL_SIZES.get(d['label'], {})) + pprint(d['label']) + + return { + 'id': video_id, + 'title': self._html_search_regex( + r'(?:Episode #[0-9]+ - )?(.*?)(?: - My Running Man [(]MyRM[)])?', + webpage, + 'title' + ), + 'formats': formats, + } + + +_="""{ + "success": true, + "player": { + "poster_file": "/userdata/220521/poster/4/0o/40ox-ry0yo8.png?v=1558638851", + "logo_file": "/userdata/220521/player/2706_logo.png?v=1558807686", + "logo_position": "control-bar", + "logo_link": "https://www.myrunningman.com", + "logo_margin": 10, + "aspectratio": "16:9", + "powered_text": "Fembed 1.6.0", + "powered_url": "https://www.fembed.com", + "css_background": "rgba(0, 0, 0, 0)", + "css_text": "#f2f2f2", + "css_menu": "#333333", + "css_mntext": "#ffffff", + "css_caption": "#000000", + "css_cttext": "#ffffff", + "css_ctsize": "15", + "css_ctopacity": "40", + "css_icon": "rgba(255, 255, 255, 0.8)", + "css_ichover": "#ffffff", + "css_tsprogress": "#f2f2f2", + "css_tsrail": "rgba(255, 255, 255, 0.3)", + "css_button": "#565656", + "css_bttext": "#ffffff", + "opt_autostart": false, + "opt_title": false, + "opt_quality": true, + "opt_caption": false, + "opt_download": false, + "opt_sharing": false, + "opt_playrate": false, + "opt_mute": false, + "opt_loop": false, + "opt_vr": false, + "opt_cast": { + "appid": "00000000" + }, + "opt_nodefault": false, + "opt_forceposter": false, + "opt_parameter": false, + "restrict_domain": "myrunningman.com", + "restrict_action": "DisplayErrorPage", + "restrict_target": "https://www.myrunningman.com/", + "adb_enable": false, + "adb_offset": "0", + "adb_text": "Please turn off adblockers in order to continue watching", + "ads_adult": false, + "ads_pop": true, + "ads_vast": true, + "ads_free": 0, + "trackingId": "", + "viewId": "", + "income": false, + "incomePop": false, + "resume_text": "Welcome back! You left off at xx:xx:xx. Would you like to resume watching?", + "resume_yes": "Yes", + "resume_no": "No", + "resume_enable": true, + "css_ctedge": "none", + "logger": "https://v3.fstats.xyz", + "revenue": "https://b.suggestvideos.xyz/scripts/coming-soon", + "revenue_fallback": "https://obefjbb4mykw.com/6b/64/32/6b64325728db266a83a1ce720563f755.js", + "revenue_track": "https://mc.yandex.ru/watch/56313682" + }, + "data": [ + { + "file": "https://fvs.io/redirector?token=VXIxalFMbFBKZE5zOVRvNjVNVWxNYkxXR2dCdis5V2xtL3lVR2E2VGxEdmVraSs4YXp2Q0MzeWJFMDA0bDhJK2ZlWDlBTlF3eTI3dXVqWWl4aHlOTHEvVkpMNHYveHRtWGhCc08xWlFZVGx3MjBaSHIrT3ZvODRZM2FZU21GaUZ2WEE0Vm00cHBpazFHcGcxaTB0Vzc3MmZ1QWs9OnZNVFkzWTdWdm02RGc1Tm9hd1M0ZEE9PQ", + "label": "480p", + "type": "mp4" + }, + { + "file": "https://fvs.io/redirector?token=NUh5RHFiR2lUUWswcXFFUEhCLzhIUk90Z0JoRWhQb21ERGJBSGhEU2RxWFhvSS9rbDRKeW4vVkRMd0RrTWlFNkYyMUU5ZGN3cmEyVWFCeVdpTGJueDl3cC9hOWF2RkY4Y2ZpYmZzeGE5c2N2NUdPWVpoc21RMUE3R0ZPU3RqY0VoTWZLQTUwMkxFTnMwZTkreVpoNzYrQnVYdz09OmZ4UlF1eFNkU3ZYT3RzOGcrZ0k3TlE9PQ", + "label": "720p", + "type": "mp4" + } + ], + "captions": [], + "is_vr": false +}""" From af2141f0c6c6848fd824080dfec9ec287eb5abf1 Mon Sep 17 00:00:00 2001 From: James Andariese Date: Sat, 25 Apr 2020 19:26:39 -0700 Subject: [PATCH 2/3] remove debug prints --- youtube_dl/extractor/myrunningman.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/youtube_dl/extractor/myrunningman.py b/youtube_dl/extractor/myrunningman.py index ec6a1b255..15e2f1fb3 100644 --- a/youtube_dl/extractor/myrunningman.py +++ b/youtube_dl/extractor/myrunningman.py @@ -1,4 +1,3 @@ -from pprint import pprint from .common import InfoExtractor LABEL_SIZES={ @@ -25,7 +24,6 @@ class MyRunningManIE(InfoExtractor): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) data_url = self._html_search_regex(r'data-url="f([^"]+)"', webpage, "data-url") - pprint('https://feurl.com/api/source/{}'.format(data_url)) source = self._download_json('https://feurl.com/api/source/{}'.format(data_url),video_id, data='r=https%3A%2F%2Fwww.myrunningman.com%2Fcache%2Fstream%2Ff{}.html&d=feurl.com'.format(data_url).encode('utf-8')) assert source['success'] @@ -35,8 +33,6 @@ class MyRunningManIE(InfoExtractor): 'ext': d['type'], 'url': d['file'], }, **LABEL_SIZES.get(d['label'], {}))) - pprint(LABEL_SIZES.get(d['label'], {})) - pprint(d['label']) return { 'id': video_id, From e177ae995ffd3671871e86369545ad81c93210c7 Mon Sep 17 00:00:00 2001 From: James Andariese Date: Sat, 25 Apr 2020 19:32:45 -0700 Subject: [PATCH 3/3] flake8 fixes --- youtube_dl/extractor/myrunningman.py | 35 ++++++++++++++-------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/youtube_dl/extractor/myrunningman.py b/youtube_dl/extractor/myrunningman.py index 15e2f1fb3..58b80600d 100644 --- a/youtube_dl/extractor/myrunningman.py +++ b/youtube_dl/extractor/myrunningman.py @@ -1,22 +1,23 @@ from .common import InfoExtractor -LABEL_SIZES={ - '480p': {"width":640, "height": 480}, - '480i': {"width":640, "height": 480}, - '720p': {"width":1280, "height": 720}, - '720i': {"width":1280, "height": 720}, - '1080p': {"width":1920, "height": 1080}, - '1080i': {"width":1920, "height": 1080}, - '1440p': {"width":2560, "height": 1440}, - '1440i': {"width":2560, "height": 1440}, - '4K': {"width":3840, "height": 2160}, - '2160p': {"width":3840, "height": 2160}, - '2160i': {"width":3840, "height": 2160}, - '8K': {"width":7680, "height": 4320}, - '4320p': {"width":7680, "height": 4320}, - '4320i': {"width":7680, "height": 4320}, +LABEL_SIZES = { + '480p': {"width": 640, "height": 480}, + '480i': {"width": 640, "height": 480}, + '720p': {"width": 1280, "height": 720}, + '720i': {"width": 1280, "height": 720}, + '1080p': {"width": 1920, "height": 1080}, + '1080i': {"width": 1920, "height": 1080}, + '1440p': {"width": 2560, "height": 1440}, + '1440i': {"width": 2560, "height": 1440}, + '4K': {"width": 3840, "height": 2160}, + '2160p': {"width": 3840, "height": 2160}, + '2160i': {"width": 3840, "height": 2160}, + '8K': {"width": 7680, "height": 4320}, + '4320p': {"width": 7680, "height": 4320}, + '4320i': {"width": 7680, "height": 4320}, } + class MyRunningManIE(InfoExtractor): _VALID_URL = r'(?:https?://)?(?:www\.)?myrunningman\.com/ep/(?P[0-9]+)$' @@ -24,7 +25,7 @@ class MyRunningManIE(InfoExtractor): video_id = self._match_id(url) webpage = self._download_webpage(url, video_id) data_url = self._html_search_regex(r'data-url="f([^"]+)"', webpage, "data-url") - source = self._download_json('https://feurl.com/api/source/{}'.format(data_url),video_id, data='r=https%3A%2F%2Fwww.myrunningman.com%2Fcache%2Fstream%2Ff{}.html&d=feurl.com'.format(data_url).encode('utf-8')) + source = self._download_json('https://feurl.com/api/source/{}'.format(data_url), video_id, data='r=https%3A%2F%2Fwww.myrunningman.com%2Fcache%2Fstream%2Ff{}.html&d=feurl.com'.format(data_url).encode('utf-8')) assert source['success'] formats = [] @@ -45,7 +46,7 @@ class MyRunningManIE(InfoExtractor): } -_="""{ +_ = """{ "success": true, "player": { "poster_file": "/userdata/220521/poster/4/0o/40ox-ry0yo8.png?v=1558638851",