]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[bandcamp] Fix thumbnail extraction
authorLuca Steeb <contact@luca-steeb.com>
Fri, 5 May 2017 20:35:42 +0000 (22:35 +0200)
committerSergey M <dstftw@gmail.com>
Fri, 5 May 2017 20:35:42 +0000 (03:35 +0700)
youtube_dl/extractor/bandcamp.py

index df2972f2684a82a7c58cafdd2fc6083cd035d8bd..489d0ba53f672363213c7f788e83b692eb11894d 100644 (file)
@@ -47,6 +47,7 @@ class BandcampIE(InfoExtractor):
         mobj = re.match(self._VALID_URL, url)
         title = mobj.group('title')
         webpage = self._download_webpage(url, title)
+        thumbnail = self._html_search_meta('og:image', webpage, default=None)
         m_download = re.search(r'freeDownloadPage: "(.*?)"', webpage)
         if not m_download:
             m_trackinfo = re.search(r'trackinfo: (.+),\s*?\n', webpage)
@@ -75,6 +76,7 @@ class BandcampIE(InfoExtractor):
                 return {
                     'id': track_id,
                     'title': data['title'],
+                    'thumbnail': thumbnail,
                     'formats': formats,
                     'duration': float_or_none(data.get('duration')),
                 }
@@ -143,7 +145,7 @@ class BandcampIE(InfoExtractor):
         return {
             'id': video_id,
             'title': title,
-            'thumbnail': info.get('thumb_url'),
+            'thumbnail': info.get('thumb_url') or thumbnail,
             'uploader': info.get('artist'),
             'artist': artist,
             'track': track,