- video = self._download_json(
- 'http://beeg.com/api/v1/video/%s' % video_id, video_id)
+ webpage = self._download_webpage(url, video_id)
+
+ beeg_version = self._search_regex(
+ r'beeg_version\s*=\s*([\da-zA-Z_-]+)', webpage, 'beeg version',
+ default='1546225636701')
+
+ qs = compat_urlparse.parse_qs(compat_urlparse.urlparse(url).query)
+ t = qs.get('t', [''])[0].split('-')
+ if len(t) > 1:
+ query = {
+ 'v': 2,
+ 's': t[0],
+ 'e': t[1],
+ }
+ else:
+ query = {'v': 1}
+
+ for api_path in ('', 'api.'):
+ video = self._download_json(
+ 'https://%sbeeg.com/api/v6/%s/video/%s'
+ % (api_path, beeg_version, video_id), video_id,
+ fatal=api_path == 'api.', query=query)
+ if video:
+ break