2016-05-06 14:02:40 +00:00
|
|
|
from .common import InfoExtractor
|
2019-03-12 07:08:54 +00:00
|
|
|
from .vk import VKIE
|
2022-02-18 16:02:14 +00:00
|
|
|
from ..compat import compat_b64decode
|
|
|
|
from ..utils import (
|
|
|
|
int_or_none,
|
|
|
|
js_to_json,
|
|
|
|
traverse_obj,
|
|
|
|
unified_timestamp,
|
2019-03-12 07:08:54 +00:00
|
|
|
)
|
2016-05-06 14:02:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
class BIQLEIE(InfoExtractor):
|
|
|
|
_VALID_URL = r'https?://(?:www\.)?biqle\.(?:com|org|ru)/watch/(?P<id>-?\d+_\d+)'
|
|
|
|
_TESTS = [{
|
2022-02-18 16:02:14 +00:00
|
|
|
'url': 'https://biqle.ru/watch/-2000421746_85421746',
|
|
|
|
'md5': 'ae6ef4f04d19ac84e4658046d02c151c',
|
2016-05-06 14:02:40 +00:00
|
|
|
'info_dict': {
|
2022-02-18 16:02:14 +00:00
|
|
|
'id': '-2000421746_85421746',
|
2016-05-06 14:02:40 +00:00
|
|
|
'ext': 'mp4',
|
2022-02-18 16:02:14 +00:00
|
|
|
'title': 'Forsaken By Hope Studio Clip',
|
|
|
|
'description': 'Forsaken By Hope Studio Clip — Смотреть онлайн',
|
|
|
|
'upload_date': '19700101',
|
|
|
|
'thumbnail': r're:https://[^/]+/impf/7vN3ACwSTgChP96OdOfzFjUCzFR6ZglDQgWsIw/KPaACiVJJxM\.jpg\?size=800x450&quality=96&keep_aspect_ratio=1&background=000000&sign=b48ea459c4d33dbcba5e26d63574b1cb&type=video_thumb',
|
|
|
|
'timestamp': 0,
|
2019-03-12 07:08:54 +00:00
|
|
|
},
|
2016-05-06 14:02:40 +00:00
|
|
|
}, {
|
2019-03-12 07:08:54 +00:00
|
|
|
'url': 'http://biqle.org/watch/-44781847_168547604',
|
2016-05-06 14:02:40 +00:00
|
|
|
'md5': '7f24e72af1db0edf7c1aaba513174f97',
|
|
|
|
'info_dict': {
|
2019-04-03 10:08:42 +00:00
|
|
|
'id': '-44781847_168547604',
|
2016-05-06 14:02:40 +00:00
|
|
|
'ext': 'mp4',
|
|
|
|
'title': 'Ребенок в шоке от автоматической мойки',
|
2022-02-18 16:02:14 +00:00
|
|
|
'description': 'Ребенок в шоке от автоматической мойки — Смотреть онлайн',
|
2019-03-12 07:08:54 +00:00
|
|
|
'timestamp': 1396633454,
|
|
|
|
'upload_date': '20140404',
|
2022-02-18 16:02:14 +00:00
|
|
|
'thumbnail': r're:https://[^/]+/c535507/u190034692/video/l_b84df002\.jpg',
|
2016-08-08 04:59:55 +00:00
|
|
|
},
|
2016-05-06 14:02:40 +00:00
|
|
|
}]
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
video_id = self._match_id(url)
|
|
|
|
webpage = self._download_webpage(url, video_id)
|
2022-02-18 16:02:14 +00:00
|
|
|
|
|
|
|
title = self._html_search_meta('name', webpage, 'Title', fatal=False)
|
|
|
|
timestamp = unified_timestamp(self._html_search_meta('uploadDate', webpage, 'Upload Date', default=None))
|
|
|
|
description = self._html_search_meta('description', webpage, 'Description', default=None)
|
|
|
|
|
|
|
|
global_embed_url = self._search_regex(
|
|
|
|
r'<script[^<]+?window.globEmbedUrl\s*=\s*\'((?:https?:)?//(?:daxab\.com|dxb\.to|[^/]+/player)/[^\']+)\'',
|
|
|
|
webpage, 'global Embed url')
|
|
|
|
hash = self._search_regex(
|
|
|
|
r'<script id="data-embed-video[^<]+?hash: "([^"]+)"[^<]*</script>', webpage, 'Hash')
|
|
|
|
|
|
|
|
embed_url = global_embed_url + hash
|
|
|
|
|
2019-03-12 07:08:54 +00:00
|
|
|
if VKIE.suitable(embed_url):
|
|
|
|
return self.url_result(embed_url, VKIE.ie_key(), video_id)
|
|
|
|
|
2020-08-27 18:20:41 +00:00
|
|
|
embed_page = self._download_webpage(
|
2022-02-18 16:02:14 +00:00
|
|
|
embed_url, video_id, 'Downloading embed webpage', headers={'Referer': url})
|
|
|
|
|
|
|
|
glob_params = self._parse_json(self._search_regex(
|
|
|
|
r'<script id="globParams">[^<]*window.globParams = ([^;]+);[^<]+</script>',
|
|
|
|
embed_page, 'Global Parameters'), video_id, transform_source=js_to_json)
|
|
|
|
host_name = compat_b64decode(glob_params['server'][::-1]).decode()
|
|
|
|
|
2019-03-12 07:08:54 +00:00
|
|
|
item = self._download_json(
|
2022-02-18 16:02:14 +00:00
|
|
|
f'https://{host_name}/method/video.get/{video_id}', video_id,
|
|
|
|
headers={'Referer': url}, query={
|
|
|
|
'token': glob_params['video']['access_token'],
|
2019-03-12 07:08:54 +00:00
|
|
|
'videos': video_id,
|
2022-02-18 16:02:14 +00:00
|
|
|
'ckey': glob_params['c_key'],
|
|
|
|
'credentials': glob_params['video']['credentials'],
|
2019-03-12 07:08:54 +00:00
|
|
|
})['response']['items'][0]
|
|
|
|
|
|
|
|
formats = []
|
|
|
|
for f_id, f_url in item.get('files', {}).items():
|
|
|
|
if f_id == 'external':
|
|
|
|
return self.url_result(f_url)
|
|
|
|
ext, height = f_id.split('_')
|
2022-02-18 16:02:14 +00:00
|
|
|
height_extra_key = traverse_obj(glob_params, ('video', 'partial', 'quality', height))
|
|
|
|
if height_extra_key:
|
|
|
|
formats.append({
|
|
|
|
'format_id': f'{height}p',
|
|
|
|
'url': f'https://{host_name}/{f_url[8:]}&videos={video_id}&extra_key={height_extra_key}',
|
|
|
|
'height': int_or_none(height),
|
|
|
|
'ext': ext,
|
|
|
|
})
|
2019-03-12 07:08:54 +00:00
|
|
|
|
|
|
|
thumbnails = []
|
|
|
|
for k, v in item.items():
|
|
|
|
if k.startswith('photo_') and v:
|
|
|
|
width = k.replace('photo_', '')
|
|
|
|
thumbnails.append({
|
|
|
|
'id': width,
|
|
|
|
'url': v,
|
|
|
|
'width': int_or_none(width),
|
|
|
|
})
|
2016-05-06 14:02:40 +00:00
|
|
|
|
|
|
|
return {
|
2019-03-12 07:08:54 +00:00
|
|
|
'id': video_id,
|
|
|
|
'title': title,
|
|
|
|
'formats': formats,
|
|
|
|
'comment_count': int_or_none(item.get('comments')),
|
2022-02-18 16:02:14 +00:00
|
|
|
'description': description,
|
2019-03-12 07:08:54 +00:00
|
|
|
'duration': int_or_none(item.get('duration')),
|
|
|
|
'thumbnails': thumbnails,
|
2022-02-18 16:02:14 +00:00
|
|
|
'timestamp': timestamp,
|
2019-03-12 07:08:54 +00:00
|
|
|
'view_count': int_or_none(item.get('views')),
|
2016-05-06 14:02:40 +00:00
|
|
|
}
|