From a21e1359117d571d3fc7c1405798361fa52d20db Mon Sep 17 00:00:00 2001 From: CeruleanSky Date: Sat, 25 Jan 2020 07:42:34 -0500 Subject: [PATCH] [bitchute] add support for mpd Multiple quality formats that are listed in mpd are slowly being deployed on the site. This adds support for the current implementation. --- youtube_dl/extractor/bitchute.py | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/youtube_dl/extractor/bitchute.py b/youtube_dl/extractor/bitchute.py index 0c773e66e..c1fade814 100644 --- a/youtube_dl/extractor/bitchute.py +++ b/youtube_dl/extractor/bitchute.py @@ -23,7 +23,7 @@ class BitChuteIE(InfoExtractor): 'title': 'Fuck bitches get money', 'description': 'md5:3f21f6fb5b1d17c3dee9cf6b5fe60b3a', 'thumbnail': r're:^https?://.*\.jpg$', - 'uploader': 'Victoria X Rave', + 'uploader': 'Victoria Rose', 'upload_date': '20170813', }, }, { @@ -32,15 +32,32 @@ class BitChuteIE(InfoExtractor): }, { 'url': 'https://www.bitchute.com/torrent/Zee5BE49045h/szoMrox2JEI.webtorrent', 'only_matching': True, + }, { + # mpd enabled video + 'url': 'https://www.bitchute.com/video/HeicRhQcU4a3/', + 'info_dict': { + 'id': 'HeicRhQcU4a3', + 'ext': 'mp4', + 'title': 'CATASTROPHE is the ONLY CURE for Inequality', + 'description': 'md5:e48cc6382ddce3345ecdd264f71b5a4a', + 'thumbnail': r're:^https?://.*\.jpg$', + 'uploader': 'Black Pigeon Speaks', + 'upload_date': '20200124', + }, + 'params': { + 'skip_download': True, + }, }] def _real_extract(self, url): video_id = self._match_id(url) + headers = { + 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.57 Safari/537.36', + } + webpage = self._download_webpage( - 'https://www.bitchute.com/video/%s' % video_id, video_id, headers={ - 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.57 Safari/537.36', - }) + 'https://www.bitchute.com/video/%s' % video_id, video_id, headers=headers) title = self._html_search_regex( (r'<[^>]+\bid=["\']video-title[^>]+>([^<]+)', r'([^<]+)'), @@ -58,6 +75,13 @@ class BitChuteIE(InfoExtractor): {'url': format_url} for format_url in orderedSet(format_urls)] + mpd_url = re.search(r"this.videoUrl = '(.+?)';", webpage) + + if mpd_url: + for mpd in mpd_url.groups(): + formats.extend(self._extract_mpd_formats( + mpd_url=mpd, video_id=video_id, headers=headers)) + if not formats: formats = self._parse_html5_media_entries( url, webpage, video_id)[0]['formats']