1 from .common
import InfoExtractor
2 from ..utils
import clean_html
, float_or_none
, get_element_by_class
, js_to_json
, traverse_obj
5 class WeVidiIE(InfoExtractor
):
6 _VALID_URL
= r
'https?://(?:www\.)?wevidi\.net/watch/(?P<id>[\w-]{11})'
8 'url': 'https://wevidi.net/watch/2th7UO5F4KV',
9 'md5': 'b913d1ff5bbad499e2c7ef4aa6d829d7',
13 'title': 'YouTube Alternative: WeVidi - customizable channels & more',
14 'thumbnail': r
're:^https?://.*\.jpg$',
15 'description': 'md5:73a27d0a87d49fbcc5584566326ebeed',
16 'uploader': 'eclecRC',
20 'url': 'https://wevidi.net/watch/ievRuuQHbPS',
21 'md5': 'ce8a94989a959bff9003fa27ee572935',
25 'title': 'WeVidi Playlists',
26 'thumbnail': r
're:^https?://.*\.jpg$',
27 'description': 'md5:32cdfca272687390d9bd9b0c9c6153ee',
32 'url': 'https://wevidi.net/watch/PcMzDWaQSWb',
33 'md5': '55ee0d3434be5d9e5cc76b83f2bb57ec',
38 'thumbnail': r
're:^https?://.*\.jpg$',
39 'description': 'md5:e2c9e2b54b8bb424cc64937c8fdc068f',
44 'url': 'https://wevidi.net/watch/wJnRqDHNe_u',
45 'md5': 'c8f263dd47e66cc17546b3abf47b5a77',
49 'title': 'Gissy Talks: YouTube Alternatives',
50 'thumbnail': r
're:^https?://.*\.jpg$',
51 'description': 'md5:e65036f0d4af80e0af191bd11af5195e',
52 'uploader': 'GissyEva',
56 'url': 'https://wevidi.net/watch/4m1c4yJR_yc',
57 'md5': 'c63ce5ca6990dce86855fc02ca5bc1ed',
61 'title': 'Enough of that! - Awesome Exilez Podcast',
62 'thumbnail': r
're:^https?://.*\.jpg$',
63 'description': 'md5:96af99dd63468b2dfab3020560e3e9b2',
64 'uploader': 'eclecRC',
69 def _extract_formats(self
, wvplayer_props
):
70 # Taken from WeVidi player JS: https://wevidi.net/layouts/default/static/player.min.js
80 src_path
= f
'{wvplayer_props["srcVID"]}/{wvplayer_props["srcUID"]}/{wvplayer_props["srcNAME"]}'
81 for res
in traverse_obj(wvplayer_props
, ('resolutions', ..., {int}
, {lambda x
: x
or None})):
82 format_id
= str(-(res
// -2) - 1)
84 'acodec': 'mp4a.40.2',
86 'format_id': format_id
,
87 'height': resolution_map
.get(res
),
88 'url': f
'https://www.wevidi.net/videoplayback/{src_path}/{format_id}',
89 'vcodec': 'avc1.42E01E',
92 def _real_extract(self
, url
):
93 video_id
= self
._match
_id
(url
)
94 webpage
= self
._download
_webpage
(url
, video_id
)
96 wvplayer_props
= self
._search
_json
(
97 r
'WVPlayer\(', webpage
, 'player', video_id
,
98 transform_source
=lambda x
: js_to_json(x
.replace('||', '}')))
102 'title': clean_html(get_element_by_class('video_title', webpage
)),
103 'description': clean_html(get_element_by_class('descr_long', webpage
)),
104 'uploader': clean_html(get_element_by_class('username', webpage
)),
105 'formats': list(self
._extract
_formats
(wvplayer_props
)),
106 'thumbnail': self
._og
_search
_thumbnail
(webpage
),
107 'duration': float_or_none(wvplayer_props
.get('duration')),