ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
132.24k stars 10.03k forks source link

xvideos not working (patch to fix) #370

Closed pocoimporta closed 12 years ago

pocoimporta commented 12 years ago

Xvideos changed the location of the video thumbnail. The following patch fixes the problem:

--- a/youtube_dl/InfoExtractors.py
+++ b/youtube_dl/InfoExtractors.py
@@ -2357,7 +2357,7 @@ class XVideosIE(InfoExtractor):

                # Extract video thumbnail
-               mobj = re.search(r'http://(?:img.*?\.)xvideos.com/videos/thumbs/[a-fA-F0-9]/[a-fA-F0-9]/[a-fA-F0-9]/([a-fA-F0-
+               mobj = re.search(r'http://(?:img.*?\.)xvideos.com/videos/thumbs/[a-fA-F0-9]+/[a-fA-F0-9]+/[a-fA-F0-9]+/[a-fA-F
                if mobj is None:
                        self._downloader.trouble(u'ERROR: unable to extract video thumbnail')
                        return
FiloSottile commented 12 years ago

Thanks! But the patch is cropped on the right ^^

pocoimporta commented 12 years ago

Oh, sorry about that. There it goes again:

diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py
index baf859e..01ec034 100644
--- a/youtube_dl/InfoExtractors.py
+++ b/youtube_dl/InfoExtractors.py
@@ -2357,7 +2357,7 @@ class XVideosIE(InfoExtractor):

        # Extract video thumbnail
-       mobj = re.search(r'http://(?:img.*?\.)xvideos.com/videos/thumbs/[a-fA-F0-9]/[a-fA-F0-9]/[a-fA-F0-9]/([a-fA-F0-9.]+jpg)', webpage)
+       mobj = re.search(r'http://(?:img.*?\.)xvideos.com/videos/thumbs/[a-fA-F0-9]+/[a-fA-F0-9]+/[a-fA-F0-9]+/[a-fA-F0-9]+/([a-fA-F0-9.]+jpg)', webpage)
        if mobj is None:
            self._downloader.trouble(u'ERROR: unable to extract video thumbnail')
            return
FiloSottile commented 12 years ago

Merged it with a small additional fix. Thank you!