2 from __future__ import unicode_literals
7 from .common import InfoExtractor
8 from ..utils import urlencode_postdata
11 class BitChuteIE(InfoExtractor):
12 _VALID_URL = r'https?://(?:www\.)?bitchute\.com/(?:video|embed|torrent/[^/]+)/(?P<id>[^/?#&]+)'
14 'url': 'https://www.bitchute.com/video/szoMrox2JEI/',
15 'md5': '66c4a70e6bfc40dcb6be3eb1d74939eb',
19 'title': 'Fuck bitches get money',
20 'description': 'md5:3f21f6fb5b1d17c3dee9cf6b5fe60b3a',
21 'thumbnail': r're:^https?://.*\.jpg$',
22 'uploader': 'Victoria X Rave',
25 'url': 'https://www.bitchute.com/embed/lbb5G1hjPhw/',
26 'only_matching': True,
28 'url': 'https://www.bitchute.com/torrent/Zee5BE49045h/szoMrox2JEI.webtorrent',
29 'only_matching': True,
32 def _real_extract(self, url):
33 video_id = self._match_id(url)
35 webpage = self._download_webpage(
36 'https://www.bitchute.com/video/%s' % video_id, video_id)
38 title = self._search_regex(
39 (r'<[^>]+\bid=["\']video-title[^>]+>([^<]+)', r'<title>([^<]+)'),
40 webpage, 'title', default=None) or self._html_search_meta(
41 'description', webpage, 'title',
42 default=None) or self._og_search_description(webpage)
45 {'url': mobj.group('url')}
46 for mobj in re.finditer(
47 r'addWebSeed\s*\(\s*(["\'])(?P<url>(?:(?!\1).)+)\1', webpage)]
48 self._sort_formats(formats)
50 description = self._html_search_regex(
51 r'(?s)<div\b[^>]+\bclass=["\']full hidden[^>]+>(.+?)</div>',
52 webpage, 'description', fatal=False)
53 thumbnail = self._og_search_thumbnail(
54 webpage, default=None) or self._html_search_meta(
55 'twitter:image:src', webpage, 'thumbnail')
56 uploader = self._html_search_regex(
57 r'(?s)<p\b[^>]+\bclass=["\']video-author[^>]+>(.+?)</p>', webpage,
58 'uploader', fatal=False)
63 'description': description,
64 'thumbnail': thumbnail,
70 class BitChuteChannelIE(InfoExtractor):
71 _VALID_URL = r'https?://(?:www\.)?bitchute\.com/channel/(?P<id>[^/?#&]+)'
73 'url': 'https://www.bitchute.com/channel/victoriaxrave/',
74 'playlist_mincount': 185,
76 'id': 'victoriaxrave',
80 _TOKEN = 'zyG6tQcGPE5swyAEFLqKUwMuMMuF6IO2DZ6ZDQjGfsL0e4dcTLwqkTTul05Jdve7'
82 def _entries(self, channel_id):
83 channel_url = 'https://www.bitchute.com/channel/%s/' % channel_id
84 for page_num in itertools.count(0):
85 data = self._download_json(
86 '%sextend/' % channel_url, channel_id,
87 'Downloading channel page %d' % (page_num + 1),
88 data=urlencode_postdata({
89 'csrfmiddlewaretoken': self._TOKEN,
91 'offset': page_num * 25
93 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
94 'Referer': channel_url,
95 'X-Requested-With': 'XMLHttpRequest',
96 'Cookie': 'csrftoken=%s' % self._TOKEN,
98 if data.get('success') is False:
100 html = data.get('html')
103 video_ids = re.findall(
104 r'class=["\']channel-videos-image-container[^>]+>\s*<a\b[^>]+\bhref=["\']/video/([^"\'/]+)',
108 for video_id in video_ids:
109 yield self.url_result(
110 'https://www.bitchute.com/video/%s' % video_id,
111 ie=BitChuteIE.ie_key(), video_id=video_id)
113 def _real_extract(self, url):
114 channel_id = self._match_id(url)
115 return self.playlist_result(
116 self._entries(channel_id), playlist_id=channel_id)