Skip to content

Commit

Permalink
[pinterest] reduce the number of HLS format requests
Browse files Browse the repository at this point in the history
  • Loading branch information
remitamine committed Mar 12, 2021
1 parent ef41434 commit 1182f95
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion youtube_dl/extractor/pinterest.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@ def _extract_video(self, data, extract_formats=True):

title = (data.get('title') or data.get('grid_title') or video_id).strip()

urls = []
formats = []
duration = None
if extract_formats:
for format_id, format_dict in data['videos']['video_list'].items():
if not isinstance(format_dict, dict):
continue
format_url = url_or_none(format_dict.get('url'))
if not format_url:
if not format_url or format_url in urls:
continue
urls.append(format_url)
duration = float_or_none(format_dict.get('duration'), scale=1000)
ext = determine_ext(format_url)
if 'hls' in format_id.lower() or ext == 'm3u8':
Expand Down

0 comments on commit 1182f95

Please sign in to comment.