iheanyi / bandcamp-dl

Simple python script to download Bandcamp albums

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bandcamp-dl fails for a track without a timestamp.

druimalban opened this issue · comments

Python version:
Python 3.7

Bandcamp-dl version:
0.0.8-12 (From homebrew on Mac OS X)

Bancamp-dl options:
-r

url:
https://thefurrowcollective.bandcamp.com/track/hind-horn

Describe the issue:
This track has no timestamp/release date. On Bandcamp, certain tracks/albums/singles don't have one. I'm not sure why - this is the only one I've found so far. Nonetheless it's obviously possible, so the program needs to account for this (unfortunately my python-fu is weak).

The program fails as follows:

Traceback (most recent call last):
  File "/usr/local/bin/bandcamp-dl", line 11, in <module>
    load_entry_point('bandcamp-downloader==0.0.8.post12', 'console_scripts', 'bandcamp-dl')()
  File "/usr/local/Cellar/bandcamp-dl/0.0.8-12_1/libexec/lib/python3.7/site-packages/bandcamp_dl/__main__.py", line 93, in main
    album = bandcamp.parse(url, True, arguments['--embed-lyrics'], arguments['--debug'])
  File "/usr/local/Cellar/bandcamp-dl/0.0.8-12_1/libexec/lib/python3.7/site-packages/bandcamp_dl/bandcamp.py", line 70, in parse
    "date": str(dt.strptime(album_release, "%d %b %Y %H:%M:%S GMT").year)
TypeError: strptime() argument 1 must be str, not None

I got the same setup. Here's the output when only using the --debug parameter:

DEBUG:root:
	URL: http://thefurrowcollective.bandcamp.com/track/hind-horn
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): thefurrowcollective.bandcamp.com
DEBUG:urllib3.connectionpool:http://thefurrowcollective.bandcamp.com:80 "GET /track/hind-horn HTTP/1.1" 301 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): thefurrowcollective.bandcamp.com
DEBUG:urllib3.connectionpool:https://thefurrowcollective.bandcamp.com:443 "GET /track/hind-horn HTTP/1.1" 200 None
DEBUG:root: Generating BandcampJSON..
DEBUG:root: Grabbing target data..
DEBUG:root: Converting JS to JSON..
DEBUG:root: Grabbing embedded script..
DEBUG:root: Grabbing target data..
DEBUG:root: Converting JS to JSON..
DEBUG:root: Grabbing embedded script..
DEBUG:root: BandcampJSON generated..
DEBUG:root: Generating Album..
Traceback (most recent call last):
  File "/usr/local/bin/bandcamp-dl", line 11, in <module>
    load_entry_point('bandcamp-downloader==0.0.8.post12', 'console_scripts', 'bandcamp-dl')()
  File "/usr/local/Cellar/bandcamp-dl/0.0.8-12_3/libexec/lib/python3.8/site-packages/bandcamp_dl/__main__.py", line 93, in main
    album = bandcamp.parse(url, True, arguments['--embed-lyrics'], arguments['--debug'])
  File "/usr/local/Cellar/bandcamp-dl/0.0.8-12_3/libexec/lib/python3.8/site-packages/bandcamp_dl/bandcamp.py", line 70, in parse
    "date": str(dt.strptime(album_release, "%d %b %Y %H:%M:%S GMT").year)
TypeError: strptime() argument 1 must be str, not None

Thanks for reporting.

Note to self: Add redundancy to album/track data

Fixed in dev branch.