2 from __future__ import unicode_literals
4 from .common import InfoExtractor
12 class BIQLEIE(InfoExtractor):
13 _VALID_URL = r'https?://(?:www\.)?biqle\.(?:com|org|ru)/watch/(?P<id>-?\d+_\d+)'
16 'url': 'https://biqle.ru/watch/-115995369_456239081',
17 'md5': '97af5a06ee4c29bbf9c001bdb1cf5c06',
21 'title': "PASSE-PARTOUT - L'ete c'est fait pour jouer",
22 'description': 'Passe-Partout',
23 'uploader_id': 'mrsimpsonstef3',
24 'uploader': 'Phanolito',
25 'upload_date': '20120822',
28 'url': 'http://biqle.org/watch/-44781847_168547604',
29 'md5': '7f24e72af1db0edf7c1aaba513174f97',
31 'id': '-44781847_168547604',
33 'title': 'Ребенок в шоке от автоматической мойки',
34 'timestamp': 1396633454,
35 'uploader': 'Dmitry Kotov',
36 'upload_date': '20140404',
37 'uploader_id': '47850140',
41 def _real_extract(self, url):
42 video_id = self._match_id(url)
43 webpage = self._download_webpage(url, video_id)
44 embed_url = self._proto_relative_url(self._search_regex(
45 r'<iframe.+?src="((?:https?:)?//(?:daxab\.com|dxb\.to|[^/]+/player)/[^"]+)".*?></iframe>',
46 webpage, 'embed url'))
47 if VKIE.suitable(embed_url):
48 return self.url_result(embed_url, VKIE.ie_key(), video_id)
50 self._request_webpage(
51 HEADRequest(embed_url), video_id, headers={'Referer': url})
52 video_id, sig, _, access_token = self._get_cookies(embed_url)['video_ext'].value.split('%3A')
53 item = self._download_json(
54 'https://api.vk.com/method/video.get', video_id,
55 headers={'User-Agent': 'okhttp/3.4.1'}, query={
56 'access_token': access_token,
60 })['response']['items'][0]
64 for f_id, f_url in item.get('files', {}).items():
65 if f_id == 'external':
66 return self.url_result(f_url)
67 ext, height = f_id.split('_')
69 'format_id': height + 'p',
71 'height': int_or_none(height),
74 self._sort_formats(formats)
77 for k, v in item.items():
78 if k.startswith('photo_') and v:
79 width = k.replace('photo_', '')
83 'width': int_or_none(width),
90 'comment_count': int_or_none(item.get('comments')),
91 'description': item.get('description'),
92 'duration': int_or_none(item.get('duration')),
93 'thumbnails': thumbnails,
94 'timestamp': int_or_none(item.get('date')),
95 'uploader': item.get('owner_id'),
96 'view_count': int_or_none(item.get('views')),