2 from __future__ import unicode_literals
7 from .common import InfoExtractor
14 class BitChuteIE(InfoExtractor):
15 _VALID_URL = r'https?://(?:www\.)?bitchute\.com/(?:video|embed|torrent/[^/]+)/(?P<id>[^/?#&]+)'
17 'url': 'https://www.bitchute.com/video/szoMrox2JEI/',
18 'md5': '66c4a70e6bfc40dcb6be3eb1d74939eb',
22 'title': 'Fuck bitches get money',
23 'description': 'md5:3f21f6fb5b1d17c3dee9cf6b5fe60b3a',
24 'thumbnail': r're:^https?://.*\.jpg$',
25 'uploader': 'Victoria X Rave',
28 'url': 'https://www.bitchute.com/embed/lbb5G1hjPhw/',
29 'only_matching': True,
31 'url': 'https://www.bitchute.com/torrent/Zee5BE49045h/szoMrox2JEI.webtorrent',
32 'only_matching': True,
35 def _real_extract(self, url):
36 video_id = self._match_id(url)
38 webpage = self._download_webpage(
39 'https://www.bitchute.com/video/%s' % video_id, video_id, headers={
40 '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',
43 title = self._html_search_regex(
44 (r'<[^>]+\bid=["\']video-title[^>]+>([^<]+)', r'<title>([^<]+)'),
45 webpage, 'title', default=None) or self._html_search_meta(
46 'description', webpage, 'title',
47 default=None) or self._og_search_description(webpage)
50 for mobj in re.finditer(
51 r'addWebSeed\s*\(\s*(["\'])(?P<url>(?:(?!\1).)+)\1', webpage):
52 format_urls.append(mobj.group('url'))
53 format_urls.extend(re.findall(r'as=(https?://[^&"\']+)', webpage))
57 for format_url in orderedSet(format_urls)]
58 self._check_formats(formats, video_id)
59 self._sort_formats(formats)
61 description = self._html_search_regex(
62 r'(?s)<div\b[^>]+\bclass=["\']full hidden[^>]+>(.+?)</div>',
63 webpage, 'description', fatal=False)
64 thumbnail = self._og_search_thumbnail(
65 webpage, default=None) or self._html_search_meta(
66 'twitter:image:src', webpage, 'thumbnail')
67 uploader = self._html_search_regex(
68 r'(?s)<p\b[^>]+\bclass=["\']video-author[^>]+>(.+?)</p>', webpage,
69 'uploader', fatal=False)
74 'description': description,
75 'thumbnail': thumbnail,
81 class BitChuteChannelIE(InfoExtractor):
82 _VALID_URL = r'https?://(?:www\.)?bitchute\.com/channel/(?P<id>[^/?#&]+)'
84 'url': 'https://www.bitchute.com/channel/victoriaxrave/',
85 'playlist_mincount': 185,
87 'id': 'victoriaxrave',
91 _TOKEN = 'zyG6tQcGPE5swyAEFLqKUwMuMMuF6IO2DZ6ZDQjGfsL0e4dcTLwqkTTul05Jdve7'
93 def _entries(self, channel_id):
94 channel_url = 'https://www.bitchute.com/channel/%s/' % channel_id
96 for page_num in itertools.count(1):
97 data = self._download_json(
98 '%sextend/' % channel_url, channel_id,
99 'Downloading channel page %d' % page_num,
100 data=urlencode_postdata({
101 'csrfmiddlewaretoken': self._TOKEN,
105 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
106 'Referer': channel_url,
107 'X-Requested-With': 'XMLHttpRequest',
108 'Cookie': 'csrftoken=%s' % self._TOKEN,
110 if data.get('success') is False:
112 html = data.get('html')
115 video_ids = re.findall(
116 r'class=["\']channel-videos-image-container[^>]+>\s*<a\b[^>]+\bhref=["\']/video/([^"\'/]+)',
120 offset += len(video_ids)
121 for video_id in video_ids:
122 yield self.url_result(
123 'https://www.bitchute.com/video/%s' % video_id,
124 ie=BitChuteIE.ie_key(), video_id=video_id)
126 def _real_extract(self, url):
127 channel_id = self._match_id(url)
128 return self.playlist_result(
129 self._entries(channel_id), playlist_id=channel_id)