Skip to content

Commit

Permalink
[yandexvideo] use old api call as fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
remitamine committed Dec 30, 2020
1 parent f7e95fb commit bdd044e
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions youtube_dl/extractor/yandexvideo.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from ..utils import (
determine_ext,
int_or_none,
try_get,
url_or_none,
)

Expand Down Expand Up @@ -64,12 +65,7 @@ class YandexVideoIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url)

content = self._download_json(
# 'https://frontend.vh.yandex.ru/v23/player/%s.json' % video_id,
# video_id, query={
# 'stream_options': 'hires',
# 'disable_trackings': 1,
# })['content']
player = try_get((self._download_json(
'https://frontend.vh.yandex.ru/graphql', video_id, data=b'''{
player(content_id: "%s") {
computed_title
Expand All @@ -90,7 +86,15 @@ def _real_extract(self, url):
title
views_count
}
}''' % video_id.encode())['player']['content']['content']
}''' % video_id.encode(), fatal=False)), lambda x: x['player']['content'])
if not player or player.get('error'):
player = self._download_json(
'https://frontend.vh.yandex.ru/v23/player/%s.json' % video_id,
video_id, query={
'stream_options': 'hires',
'disable_trackings': 1,
})
content = player['content']

title = content.get('title') or content['computed_title']

Expand Down

0 comments on commit bdd044e

Please sign in to comment.