Browse Source

[extractor/common] Add _remove_duplicate_formats

totalwebcasting
Sergey M․ 9 years ago
parent
commit
f5bdb44443
1 changed files with 10 additions and 0 deletions
  1. +10
    -0
      youtube_dl/extractor/common.py

+ 10
- 0
youtube_dl/extractor/common.py View File

@ -900,6 +900,16 @@ class InfoExtractor(object):
item='%s video format' % f.get('format_id') if f.get('format_id') else 'video'),
formats)
@staticmethod
def _remove_duplicate_formats(formats):
format_urls = set()
unique_formats = []
for f in formats:
if f['url'] not in format_urls:
format_urls.add(f['url'])
unique_formats.append(f)
formats[:] = unique_formats
def _is_valid_url(self, url, video_id, item='video'):
url = self._proto_relative_url(url, scheme='http:')
# For now assume non HTTP(S) URLs always valid


Loading…
Cancel
Save