Skip to content

Commit

Permalink
[fix] python 2 "url" field is missing or empty
Browse files Browse the repository at this point in the history
`try_get` fails for `expected_type=str`, because in python 2
string has `unicode` type.

This commit removes the `expected_type` to disable the comparison.
  • Loading branch information
skyme5 committed Aug 1, 2020
1 parent 6255e56 commit b19eec0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions youtube_dl/extractor/tiktok.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def _extract_aweme(self, video_data, webpage):

formats = []
formats.append({
'url': try_get(video_info, lambda x: x['video']['urls'][0], str),
'url': try_get(video_info, lambda x: x['video']['urls'][0]),
'ext': 'mp4',
'height': height,
'width': width
Expand All @@ -47,7 +47,7 @@ def _extract_aweme(self, video_data, webpage):
'id': str_or_none(video_info.get('id')),
'like_count': int_or_none(video_info.get('diggCount')),
'repost_count': int_or_none(video_info.get('shareCount')),
'thumbnail': try_get(video_info, lambda x: x['covers'][0], str),
'thumbnail': try_get(video_info, lambda x: x['covers'][0]),
'timestamp': timestamp,
'width': width,
'title': self._og_search_title(webpage),
Expand Down

0 comments on commit b19eec0

Please sign in to comment.