From 097f1663a90b6db14d31102c690cc33448a47cf9 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Fri, 20 Nov 2020 14:26:24 +0530 Subject: [PATCH] Detect embedded bitchute videos --- youtube_dlc/extractor/bitchute.py | 8 ++++++++ youtube_dlc/extractor/generic.py | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/youtube_dlc/extractor/bitchute.py b/youtube_dlc/extractor/bitchute.py index 92fc70b5a..94219a138 100644 --- a/youtube_dlc/extractor/bitchute.py +++ b/youtube_dlc/extractor/bitchute.py @@ -36,6 +36,14 @@ class BitChuteIE(InfoExtractor): 'only_matching': True, }] + @staticmethod + def _extract_urls(webpage): + return [ + mobj.group('url') + for mobj in re.finditer( + r'<(?:script|iframe)[^>]+\bsrc=(["\'])(?P%s)' % BitChuteIE._VALID_URL, + webpage)] + def _real_extract(self, url): video_id = self._match_id(url) diff --git a/youtube_dlc/extractor/generic.py b/youtube_dlc/extractor/generic.py index aba06b328..2ea46da30 100644 --- a/youtube_dlc/extractor/generic.py +++ b/youtube_dlc/extractor/generic.py @@ -119,6 +119,7 @@ from .zype import ZypeIE from .odnoklassniki import OdnoklassnikiIE from .kinja import KinjaEmbedIE +from .bitchute import BitChuteIE class GenericIE(InfoExtractor): @@ -3213,6 +3214,11 @@ def _real_extract(self, url): return self.playlist_from_matches( zype_urls, video_id, video_title, ie=ZypeIE.ie_key()) + bitchute_urls = BitChuteIE._extract_urls(webpage) + if bitchute_urls: + return self.playlist_from_matches( + bitchute_urls, video_id, video_title, ie=BitChuteIE.ie_key()) + # Look for HTML5 media entries = self._parse_html5_media_entries(url, webpage, video_id, m3u8_id='hls') if entries: