2 from __future__ import unicode_literals
4 from .common import InfoExtractor
8 compat_urllib_parse_unquote,
10 from ..utils import int_or_none
13 class BIQLEIE(InfoExtractor):
14 _VALID_URL = r'https?://(?:www\.)?biqle\.(?:com|org|ru)/watch/(?P<id>-?\d+_\d+)'
17 'url': 'https://biqle.ru/watch/-115995369_456239081',
18 'md5': '97af5a06ee4c29bbf9c001bdb1cf5c06',
22 'title': "PASSE-PARTOUT - L'ete c'est fait pour jouer",
23 'description': 'Passe-Partout',
24 'uploader_id': 'mrsimpsonstef3',
25 'uploader': 'Phanolito',
26 'upload_date': '20120822',
29 'url': 'http://biqle.org/watch/-44781847_168547604',
30 'md5': '7f24e72af1db0edf7c1aaba513174f97',
32 'id': '-44781847_168547604',
34 'title': 'Ребенок в шоке от автоматической мойки',
35 'timestamp': 1396633454,
36 'uploader': 'Dmitry Kotov',
37 'upload_date': '20140404',
38 'uploader_id': '47850140',
42 def _real_extract(self, url):
43 video_id = self._match_id(url)
44 webpage = self._download_webpage(url, video_id)
45 embed_url = self._proto_relative_url(self._search_regex(
46 r'<iframe.+?src="((?:https?:)?//(?:daxab\.com|dxb\.to|[^/]+/player)/[^"]+)".*?></iframe>',
47 webpage, 'embed url'))
48 if VKIE.suitable(embed_url):
49 return self.url_result(embed_url, VKIE.ie_key(), video_id)
51 embed_page = self._download_webpage(
52 embed_url, video_id, headers={'Referer': url})
53 video_ext = self._get_cookies(embed_url).get('video_ext')
55 video_ext = compat_urllib_parse_unquote(video_ext.value)
57 video_ext = compat_b64decode(self._search_regex(
58 r'video_ext\s*:\s*[\'"]([A-Za-z0-9+/=]+)',
59 embed_page, 'video_ext')).decode()
60 video_id, sig, _, access_token = video_ext.split(':')
61 item = self._download_json(
62 'https://api.vk.com/method/video.get', video_id,
63 headers={'User-Agent': 'okhttp/3.4.1'}, query={
64 'access_token': access_token,
68 })['response']['items'][0]
72 for f_id, f_url in item.get('files', {}).items():
73 if f_id == 'external':
74 return self.url_result(f_url)
75 ext, height = f_id.split('_')
77 'format_id': height + 'p',
79 'height': int_or_none(height),
82 self._sort_formats(formats)
85 for k, v in item.items():
86 if k.startswith('photo_') and v:
87 width = k.replace('photo_', '')
91 'width': int_or_none(width),
98 'comment_count': int_or_none(item.get('comments')),
99 'description': item.get('description'),
100 'duration': int_or_none(item.get('duration')),
101 'thumbnails': thumbnails,
102 'timestamp': int_or_none(item.get('date')),
103 'uploader': item.get('owner_id'),
104 'view_count': int_or_none(item.get('views')),