projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6ab35f5
)
[npo] Validate and filter format URLs (closes #15709)
author
Sergey M․
<dstftw@gmail.com>
Mon, 26 Feb 2018 14:50:51 +0000
(21:50 +0700)
committer
Sergey M․
<dstftw@gmail.com>
Mon, 26 Feb 2018 14:50:51 +0000
(21:50 +0700)
youtube_dl/extractor/npo.py
patch
|
blob
|
history
diff --git
a/youtube_dl/extractor/npo.py
b/youtube_dl/extractor/npo.py
index f756331f878165694611a0338b83f829037e7830..eafce4b84a3b85221bc75ed9973a24a2b2766633 100644
(file)
--- a/
youtube_dl/extractor/npo.py
+++ b/
youtube_dl/extractor/npo.py
@@
-195,6
+195,10
@@
class NPOIE(NPOBaseIE):
formats = []
urls = set()
formats = []
urls = set()
+ def is_legal_url(format_url):
+ return format_url and format_url not in urls and re.match(
+ r'^(?:https?:)?//', format_url)
+
QUALITY_LABELS = ('Laag', 'Normaal', 'Hoog')
QUALITY_FORMATS = ('adaptive', 'wmv_sb', 'h264_sb', 'wmv_bb', 'h264_bb', 'wvc1_std', 'h264_std')
QUALITY_LABELS = ('Laag', 'Normaal', 'Hoog')
QUALITY_FORMATS = ('adaptive', 'wmv_sb', 'h264_sb', 'wmv_bb', 'h264_bb', 'wvc1_std', 'h264_std')
@@
-208,7
+212,7
@@
class NPOIE(NPOBaseIE):
})['items'][0]
for num, item in enumerate(items):
item_url = item.get('url')
})['items'][0]
for num, item in enumerate(items):
item_url = item.get('url')
- if not i
tem_url or item_url in urls
:
+ if not i
s_legal_url(item_url)
:
continue
urls.add(item_url)
format_id = self._search_regex(
continue
urls.add(item_url)
format_id = self._search_regex(
@@
-279,7
+283,7
@@
class NPOIE(NPOBaseIE):
if not is_live:
for num, stream in enumerate(metadata.get('streams', [])):
stream_url = stream.get('url')
if not is_live:
for num, stream in enumerate(metadata.get('streams', [])):
stream_url = stream.get('url')
- if not
stream_url or stream_url in urls
:
+ if not
is_legal_url(stream_url)
:
continue
urls.add(stream_url)
# smooth streaming is not supported
continue
urls.add(stream_url)
# smooth streaming is not supported