Skip to content

Commit

Permalink
Merge pull request #8 from rg3/master
Browse files Browse the repository at this point in the history
[pull] master from rg3:master
  • Loading branch information
pull[bot] authored Dec 16, 2018
2 parents 2c7b282 + 21c340b commit e5db314
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions youtube_dl/extractor/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
unified_strdate,
unsmuggle_url,
uppercase_escape,
url_or_none,
urlencode_postdata,
)

Expand Down Expand Up @@ -1386,8 +1387,11 @@ def make_captions(sub_url, sub_langs):
self._downloader.report_warning(err_msg)
return {}

def _mark_watched(self, video_id, video_info):
playback_url = video_info.get('videostats_playback_base_url', [None])[0]
def _mark_watched(self, video_id, video_info, player_response):
playback_url = url_or_none(try_get(
player_response,
lambda x: x['playbackTracking']['videostatsPlaybackUrl']['baseUrl']) or try_get(
video_info, lambda x: x['videostats_playback_base_url'][0]))
if not playback_url:
return
parsed_playback_url = compat_urlparse.urlparse(playback_url)
Expand Down Expand Up @@ -2122,7 +2126,7 @@ def decrypt_sig(mobj):

self._sort_formats(formats)

self.mark_watched(video_id, video_info)
self.mark_watched(video_id, video_info, player_response)

return {
'id': video_id,
Expand Down

0 comments on commit e5db314

Please sign in to comment.