2013-06-23 16:25:46 -04:00
|
|
|
|
from .common import InfoExtractor
|
2024-01-29 15:16:46 -05:00
|
|
|
|
from ..utils import ExtractorError, base_url, int_or_none, url_basename
|
|
|
|
|
from ..utils.traversal import traverse_obj
|
2013-06-23 16:25:46 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Vbox7IE(InfoExtractor):
|
2016-12-20 09:51:11 -05:00
|
|
|
|
_VALID_URL = r'''(?x)
|
|
|
|
|
https?://
|
|
|
|
|
(?:[^/]+\.)?vbox7\.com/
|
|
|
|
|
(?:
|
|
|
|
|
play:|
|
|
|
|
|
(?:
|
|
|
|
|
emb/external\.php|
|
|
|
|
|
player/ext\.swf
|
|
|
|
|
)\?.*?\bvid=
|
|
|
|
|
)
|
|
|
|
|
(?P<id>[\da-fA-F]+)
|
|
|
|
|
'''
|
2022-07-31 21:23:25 -04:00
|
|
|
|
_EMBED_REGEX = [r'<iframe[^>]+src=(?P<q>["\'])(?P<url>(?:https?:)?//vbox7\.com/emb/external\.php.+?)(?P=q)']
|
2017-02-18 15:53:23 -05:00
|
|
|
|
_GEO_COUNTRIES = ['BG']
|
2016-08-13 04:47:20 -04:00
|
|
|
|
_TESTS = [{
|
|
|
|
|
'url': 'http://vbox7.com/play:0946fff23c',
|
2024-01-29 15:16:46 -05:00
|
|
|
|
'md5': '50ca1f78345a9c15391af47d8062d074',
|
2016-08-13 04:47:20 -04:00
|
|
|
|
'info_dict': {
|
|
|
|
|
'id': '0946fff23c',
|
|
|
|
|
'ext': 'mp4',
|
|
|
|
|
'title': 'Борисов: Притеснен съм за бъдещето на България',
|
2016-12-20 09:51:11 -05:00
|
|
|
|
'description': 'По думите му е опасно страната ни да бъде обявена за "сигурна"',
|
2017-01-02 07:08:07 -05:00
|
|
|
|
'thumbnail': r're:^https?://.*\.jpg$',
|
2016-12-20 09:51:11 -05:00
|
|
|
|
'timestamp': 1470982814,
|
|
|
|
|
'upload_date': '20160812',
|
|
|
|
|
'uploader': 'zdraveibulgaria',
|
2024-01-29 15:16:46 -05:00
|
|
|
|
'view_count': int,
|
|
|
|
|
'duration': 2640,
|
2016-08-13 04:47:20 -04:00
|
|
|
|
},
|
|
|
|
|
}, {
|
2014-02-04 17:02:53 -05:00
|
|
|
|
'url': 'http://vbox7.com/play:249bb972c2',
|
2024-01-29 15:16:46 -05:00
|
|
|
|
'md5': 'da1dd2eb245200cb86e6d09d43232116',
|
2014-02-04 17:02:53 -05:00
|
|
|
|
'info_dict': {
|
|
|
|
|
'id': '249bb972c2',
|
2014-09-27 04:53:02 -04:00
|
|
|
|
'ext': 'mp4',
|
2014-02-04 17:02:53 -05:00
|
|
|
|
'title': 'Смях! Чудо - чист за секунди - Скрита камера',
|
2024-01-29 15:16:46 -05:00
|
|
|
|
'uploader': 'svideteliat_ot_varshava',
|
|
|
|
|
'view_count': int,
|
|
|
|
|
'timestamp': 1360215023,
|
|
|
|
|
'thumbnail': 'https://i49.vbox7.com/design/iconci/png/noimg6.png',
|
|
|
|
|
'description': 'Смях! Чудо - чист за секунди - Скрита камера',
|
|
|
|
|
'upload_date': '20130207',
|
|
|
|
|
'duration': 83,
|
2014-02-04 17:02:53 -05:00
|
|
|
|
},
|
2024-01-29 15:16:46 -05:00
|
|
|
|
'expected_warnings': ['Failed to download m3u8 information'],
|
2016-08-16 13:42:02 -04:00
|
|
|
|
}, {
|
|
|
|
|
'url': 'http://vbox7.com/emb/external.php?vid=a240d20f9c&autoplay=1',
|
|
|
|
|
'only_matching': True,
|
2016-12-20 09:51:11 -05:00
|
|
|
|
}, {
|
|
|
|
|
'url': 'http://i49.vbox7.com/player/ext.swf?vid=0946fff23c&autoplay=1',
|
|
|
|
|
'only_matching': True,
|
2016-08-13 04:47:20 -04:00
|
|
|
|
}]
|
2013-06-23 16:25:46 -04:00
|
|
|
|
|
2014-02-04 17:02:53 -05:00
|
|
|
|
def _real_extract(self, url):
|
2014-12-13 06:24:42 -05:00
|
|
|
|
video_id = self._match_id(url)
|
2013-06-23 16:25:46 -04:00
|
|
|
|
|
2024-01-29 15:16:46 -05:00
|
|
|
|
data = self._download_json(
|
|
|
|
|
'https://www.vbox7.com/aj/player/item/options', video_id,
|
|
|
|
|
query={'vid': video_id})['options']
|
2013-06-23 16:25:46 -04:00
|
|
|
|
|
2024-01-29 15:16:46 -05:00
|
|
|
|
src_url = data.get('src')
|
|
|
|
|
if src_url in (None, '', 'blank'):
|
|
|
|
|
raise ExtractorError('Video is unavailable', expected=True)
|
2016-12-20 09:51:11 -05:00
|
|
|
|
|
2024-01-29 15:16:46 -05:00
|
|
|
|
fmt_base = url_basename(src_url).rsplit('.', 1)[0].rsplit('_', 1)[0]
|
|
|
|
|
if fmt_base == 'vn':
|
|
|
|
|
self.raise_geo_restricted()
|
2016-12-20 09:51:11 -05:00
|
|
|
|
|
2024-01-29 15:16:46 -05:00
|
|
|
|
fmt_base = base_url(src_url) + fmt_base
|
2016-12-20 09:51:11 -05:00
|
|
|
|
|
2024-01-29 15:16:46 -05:00
|
|
|
|
formats = self._extract_m3u8_formats(
|
|
|
|
|
f'{fmt_base}.m3u8', video_id, m3u8_id='hls', fatal=False)
|
|
|
|
|
# TODO: Add MPD formats, when dash range support is added
|
|
|
|
|
for res in traverse_obj(data, ('resolutions', lambda _, v: v != 0, {int})):
|
|
|
|
|
formats.append({
|
|
|
|
|
'url': f'{fmt_base}_{res}.mp4',
|
|
|
|
|
'format_id': f'http-{res}',
|
|
|
|
|
'height': res,
|
|
|
|
|
})
|
2016-12-20 09:51:11 -05:00
|
|
|
|
|
2024-01-29 15:16:46 -05:00
|
|
|
|
return {
|
2014-02-04 17:02:53 -05:00
|
|
|
|
'id': video_id,
|
2024-01-29 15:16:46 -05:00
|
|
|
|
'formats': formats,
|
|
|
|
|
**self._search_json_ld(self._download_webpage(
|
|
|
|
|
f'https://www.vbox7.com/play:{video_id}', video_id, fatal=False) or '', video_id, fatal=False),
|
|
|
|
|
**traverse_obj(data, {
|
|
|
|
|
'title': ('title', {str}),
|
|
|
|
|
'uploader': ('uploader', {str}),
|
|
|
|
|
'duration': ('duration', {int_or_none}),
|
|
|
|
|
}),
|
|
|
|
|
}
|