From 75493fcc0e106db7e6b1e781eb431eb203e594f8 Mon Sep 17 00:00:00 2001 From: chazardsquair <48913100+chazardsquair@users.noreply.github.com> Date: Mon, 29 Apr 2019 06:37:12 -0500 Subject: [PATCH] Handle 404's Display error message when attempting to download deleted or removed video, or when the page cannot be found --- youtube_dl/extractor/xvideos.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/xvideos.py b/youtube_dl/extractor/xvideos.py index fea1ace94..15107e81b 100644 --- a/youtube_dl/extractor/xvideos.py +++ b/youtube_dl/extractor/xvideos.py @@ -85,8 +85,20 @@ class XVideosIE(InfoExtractor): video_id = self._match_id(url) webpage = self._download_webpage( - 'https://www.xvideos.com/video%s/' % video_id, video_id) + 'https://www.xvideos.com/video%s/' % video_id, video_id, expected_status=404) + status_404 = get_element_by_class("status-404", webpage) or get_element_by_class("http-error-page", webpage) + if status_404: + reg_not_found = r'