2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
14 class CrowdBunkerIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:www\.)?crowdbunker\.com/v/(?P<id>[^/?#$&]+)'
18 'url': 'https://crowdbunker.com/v/0z4Kms8pi8I',
22 'title': '117) Pass vax et solutions',
23 'description': 'md5:86bcb422c29475dbd2b5dcfa6ec3749c',
26 'uploader': 'Jérémie Mercier',
27 'uploader_id': 'UCeN_qQV829NYf0pvPJhW5dQ',
29 'upload_date': '20211218',
30 'thumbnail': 'https://scw.divulg.org/cb-medias4/images/0z4Kms8pi8I/maxres.jpg'
32 'params': {'skip_download': True}
35 def _real_extract(self
, url
):
36 id = self
._match
_id
(url
)
37 data_json
= self
._download
_json
(f
'https://api.divulg.org/post/{id}/details',
38 id, headers
={'accept': 'application/json, text/plain, */*'}
)
39 video_json
= data_json
['video']
40 formats
, subtitles
= [], {}
41 for sub
in video_json
.get('captions') or []:
42 sub_url
= try_get(sub
, lambda x
: x
['file']['url'])
45 subtitles
.setdefault(sub
.get('languageCode', 'fr'), []).append({
49 mpd_url
= try_get(video_json
, lambda x
: x
['dashManifest']['url'])
51 fmts
, subs
= self
._extract
_mpd
_formats
_and
_subtitles
(mpd_url
, id)
53 subtitles
= self
._merge
_subtitles
(subtitles
, subs
)
54 m3u8_url
= try_get(video_json
, lambda x
: x
['hlsManifest']['url'])
56 fmts
, subs
= self
._extract
_m
3u8_formats
_and
_subtitles
(mpd_url
, id)
58 subtitles
= self
._merge
_subtitles
(subtitles
, subs
)
62 'height': int_or_none(image
.get('height')),
63 'width': int_or_none(image
.get('width')),
64 } for image
in video_json
.get('thumbnails') or [] if image
.get('url')]
66 self
._sort
_formats
(formats
)
69 'title': video_json
.get('title'),
70 'description': video_json
.get('description'),
71 'view_count': video_json
.get('viewCount'),
72 'duration': video_json
.get('duration'),
73 'uploader': try_get(data_json
, lambda x
: x
['channel']['name']),
74 'uploader_id': try_get(data_json
, lambda x
: x
['channel']['id']),
75 'like_count': data_json
.get('likesCount'),
76 'upload_date': unified_strdate(video_json
.get('publishedAt') or video_json
.get('createdAt')),
77 'thumbnails': thumbnails
,
79 'subtitles': subtitles
,
83 class CrowdBunkerChannelIE(InfoExtractor
):
84 _VALID_URL
= r
'https?://(?:www\.)?crowdbunker\.com/@(?P<id>[^/?#$&]+)'
87 'url': 'https://crowdbunker.com/@Milan_UHRIN',
88 'playlist_mincount': 14,
94 def _entries(self
, id):
97 for page
in itertools
.count():
98 channel_json
= self
._download
_json
(
99 f
'https://api.divulg.org/organization/{id}/posts', id, headers
={'accept': 'application/json, text/plain, */*'}
,
100 query
={'after': last}
if last
else {}, note=f'Downloading Page {page}
')
101 for item in channel_json.get('items
') or []:
102 v_id = item.get('uid
')
105 yield self.url_result(
106 'https
://crowdbunker
.com
/v
/%s' % v_id, ie=CrowdBunkerIE.ie_key(), video_id=v_id)
107 last = channel_json.get('last
')
111 def _real_extract(self, url):
112 id = self._match_id(url)
113 return self.playlist_result(self._entries(id), playlist_id=id)