]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/bitchute.py
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
, headers
={
37 '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',
40 title
= self
._search
_regex
(
41 (r
'<[^>]+\bid=["\']video
-title
[^
>]+>([^
<]+)', r'<title
>([^
<]+)'),
42 webpage, 'title
', default=None) or self._html_search_meta(
43 'description
', webpage, 'title
',
44 default=None) or self._og_search_description(webpage)
47 {'url
': mobj.group('url
')}
48 for mobj in re.finditer(
49 r'addWebSeed\s
*\
(\s
*(["\'])(?P<url>(?:(?!\1).)+)\1', webpage)]
50 self._sort_formats(formats)
52 description = self._html_search_regex(
53 r'(?s)<div\b[^>]+\bclass=["\']full hidden
[^
>]+>(.+?
)</div
>',
54 webpage, 'description
', fatal=False)
55 thumbnail = self._og_search_thumbnail(
56 webpage, default=None) or self._html_search_meta(
57 'twitter
:image
:src
', webpage, 'thumbnail
')
58 uploader = self._html_search_regex(
59 r'(?s
)<p
\b[^
>]+\bclass
=["\']video-author[^>]+>(.+?)</p>', webpage,
60 'uploader', fatal=False)
65 'description': description,
66 'thumbnail': thumbnail,
72 class BitChuteChannelIE(InfoExtractor):
73 _VALID_URL = r'https?://(?:www\.)?bitchute\.com/channel/(?P<id>[^/?#&]+)'
75 'url': 'https://www.bitchute.com/channel/victoriaxrave/',
76 'playlist_mincount': 185,
78 'id': 'victoriaxrave',
82 _TOKEN = 'zyG6tQcGPE5swyAEFLqKUwMuMMuF6IO2DZ6ZDQjGfsL0e4dcTLwqkTTul05Jdve7'
84 def _entries(self, channel_id):
85 channel_url = 'https://www.bitchute.com/channel/%s/' % channel_id
87 for page_num in itertools.count(1):
88 data = self._download_json(
89 '%sextend/' % channel_url, channel_id,
90 'Downloading channel page %d' % page_num,
91 data=urlencode_postdata({
92 'csrfmiddlewaretoken': self._TOKEN,
96 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
97 'Referer': channel_url,
98 'X-Requested-With': 'XMLHttpRequest',
99 'Cookie': 'csrftoken=%s' % self._TOKEN,
101 if data.get('success') is False:
103 html = data.get('html')
106 video_ids = re.findall(
107 r'class=["\']channel
-videos
-image
-container
[^
>]+>\s
*<a
\b[^
>]+\bhref
=["\']/video/([^"\'/]+)',
111 offset += len(video_ids)
112 for video_id in video_ids:
113 yield self.url_result(
114 'https
://www
.bitchute
.com
/video
/%s' % video_id,
115 ie=BitChuteIE.ie_key(), video_id=video_id)
117 def _real_extract(self, url):
118 channel_id = self._match_id(url)
119 return self.playlist_result(
120 self._entries(channel_id), playlist_id=channel_id)