summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPhilipp Hagemeister <[email protected]>2014-08-24 02:24:47 +0200
committerPhilipp Hagemeister <[email protected]>2014-08-24 02:24:49 +0200
commitfa8deaf38b0d576d693a6565dcdb3b29877a4c94 (patch)
tree589dcd2f2262463e4ebe24449377172f940408be
parent685759005919d004dd82acfc4ed88ea60de6111a (diff)
downloadyoutube-dl-fa8deaf38b0d576d693a6565dcdb3b29877a4c94.tar.gz
youtube-dl-fa8deaf38b0d576d693a6565dcdb3b29877a4c94.zip
[generic] Prevent from downloading a .swf as a video
We're seeing quite a number of people who do not put a video file in the og:video field, but the player URL. Try to detect some of these and filter them out.
-rw-r--r--youtube_dl/extractor/generic.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/youtube_dl/extractor/generic.py b/youtube_dl/extractor/generic.py
index 2ba86878b..5bd315051 100644
--- a/youtube_dl/extractor/generic.py
+++ b/youtube_dl/extractor/generic.py
@@ -831,7 +831,12 @@ class GenericIE(InfoExtractor):
m_video_type = re.findall(r'<meta.*?property="og:video:type".*?content="video/(.*?)"', webpage)
# We only look in og:video if the MIME type is a video, don't try if it's a Flash player:
if m_video_type is not None:
- found = re.findall(r'<meta.*?property="og:video".*?content="(.*?)"', webpage)
+ def check_video(vurl):
+ vpath = compat_urlparse.urlparse(vurl).path
+ return not vpath.endswith('.swf')
+ found = list(filter(
+ check_video,
+ re.findall(r'<meta.*?property="og:video".*?content="(.*?)"', webpage)))
if not found:
# HTML5 video
found = re.findall(r'(?s)<video[^<]*(?:>.*?<source.*?)? src="([^"]+)"', webpage)