logo

youtube-dl

[mirror] Download/Watch videos from video hosters
commit: e91df0c5501bd5df9987e310a37df51129ee1cf2
parent c5636e9bcaf37f2190b1e7d73785fde399001c29
Author: Sergey M․ <dstftw@gmail.com>
Date:   Fri,  4 Dec 2020 23:56:50 +0700

[pornhub] Handle HTTP errors gracefully (closes #26414)

Diffstat:

Myoutube_dl/extractor/pornhub.py7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/youtube_dl/extractor/pornhub.py b/youtube_dl/extractor/pornhub.py @@ -31,7 +31,12 @@ class PornHubBaseIE(InfoExtractor): def dl(*args, **kwargs): return super(PornHubBaseIE, self)._download_webpage_handle(*args, **kwargs) - webpage, urlh = dl(*args, **kwargs) + ret = dl(*args, **kwargs) + + if not ret: + return ret + + webpage, urlh = ret if any(re.search(p, webpage) for p in ( r'<body\b[^>]+\bonload=["\']go\(\)',