Repository: ytdl-org/youtube-dl

Issue:
[bandcamp] crashes on paid tracks
Latest git-version '22d7368dfb384e7698faad6d2891b4aaceab3d7c' crashes on attempt to download
http://music.bucketheadpikes.com/track/crumple-part-two
This track is not playable in browser. Thus it could be better to display any error text.

> bash-3.2$ ./youtube-dl -v http://music.bucketheadpikes.com/track/crumple-part-two
> [debug] System config: []
> [debug] User config: []
> [debug] Command-line args: [u'-v', u'http://music.bucketheadpikes.com/track/crumple-part-two']
> [debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
> [debug] youtube-dl version 2015.11.27.1
> [debug] Python version 2.7.10 - Darwin-14.5.0-x86_64-i386-64bit
> [debug] exe versions: avconv v10_beta1-440-gb33c64e, avprobe v10_beta1-440-gb33c64e, ffmpeg 2.8.2, ffprobe 2.8.2
> [debug] Proxy map: {}
> [generic] crumple-part-two: Requesting header
> WARNING: Falling back on generic information extractor.
> [generic] crumple-part-two: Downloading webpage
> [generic] crumple-part-two: Extracting information
> [Bandcamp] crumple-part-two: Downloading webpage
> Traceback (most recent call last):
>   File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
>     "__main__", fname, loader, pkg_name)
>   File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
>     exec code in run_globals
>   File "./youtube-dl/__main__.py", line 19, in <module>
>   File "./youtube-dl/youtube_dl/**init**.py", line 410, in main
>   File "./youtube-dl/youtube_dl/**init**.py", line 400, in _real_main
>   File "./youtube-dl/youtube_dl/YoutubeDL.py", line 1669, in download
>   File "./youtube-dl/youtube_dl/YoutubeDL.py", line 674, in extract_info
>   File "./youtube-dl/youtube_dl/YoutubeDL.py", line 727, in process_ie_result
>   File "./youtube-dl/youtube_dl/YoutubeDL.py", line 663, in extract_info
>   File "./youtube-dl/youtube_dl/extractor/common.py", line 290, in extract
>   File "./youtube-dl/youtube_dl/extractor/bandcamp.py", line 53, in _real_extract
> AttributeError: 'NoneType' object has no attribute 'items'



Discussion:

Resolving patch:
diff --git a/youtube_dl/extractor/bandcamp.py b/youtube_dl/extractor/bandcamp.py
--- a/youtube_dl/extractor/bandcamp.py
+++ b/youtube_dl/extractor/bandcamp.py
@@ -29,7 +29,7 @@ class BandcampIE(InfoExtractor):
         '_skip': 'There is a limit of 200 free downloads / month for the test song'
     }, {
         'url': 'http://benprunty.bandcamp.com/track/lanius-battle',
-        'md5': '2b68e5851514c20efdff2afc5603b8b4',
+        'md5': '73d0b3171568232574e45652f8720b5c',
         'info_dict': {
             'id': '2650410135',
             'ext': 'mp3',
@@ -48,6 +48,10 @@ def _real_extract(self, url):
             if m_trackinfo:
                 json_code = m_trackinfo.group(1)
                 data = json.loads(json_code)[0]
+                track_id = compat_str(data['id'])
+
+                if not data.get('file'):
+                    raise ExtractorError('Not streamable', video_id=track_id, expected=True)
 
                 formats = []
                 for format_id, format_url in data['file'].items():
@@ -64,7 +68,7 @@ def _real_extract(self, url):
                 self._sort_formats(formats)
 
                 return {
-                    'id': compat_str(data['id']),
+                    'id': track_id,
                     'title': data['title'],
                     'formats': formats,
                     'duration': float_or_none(data.get('duration')),


Test patch: