Fixed complete failure after Bandcamp site update.

Fixes: #113, #110
master
Anthony Forsberg 2017-05-08 12:58:03 -04:00
parent 6f4be1cc7a
commit c881c1d00d
5 changed files with 31 additions and 30 deletions

View File

@ -1,39 +1,42 @@
bandcamp-dl - download audio from BandCamp.com
bandcamp-dl
===========
download audio from BandCamp.com
Synopsis
========
--------
bandcamp-dl URL
Installation
============
------------
From PyPI
---------
~~~~~~~~~
``pip install bandcamp-downloader``
From Wheel
----------
~~~~~~~~~~
1. Download the wheel (``.whl``) from PyPI or the Releases page
2. ``cd`` to the directory containing the ``.whl`` file
3. ``pip install <filename>.whl``
[OSX] From Homebrew
-------------------
~~~~~~~~~~~~~~~~~~~
``brew install bandcamp-dl``
From Source
-----------
~~~~~~~~~~~
1. Clone the project or `download and extract the zip <https://github.com/iheanyi/bandcamp-dl/archive/master.zip>`_
2. ``cd`` to the project directory containing the ``setup.py``
3. ``python setup.py install``
Description
===========
-----------
bandcamp-dl is a small command-line app to download audio from
BandCamp.com. It requires the Python interpreter, version 3.5+ and is
@ -41,7 +44,7 @@ not platform specific. It is released to the public domain, which means
you can modify it, redistribute it or use it how ever you like.
Details
=======
-------
::
@ -55,12 +58,11 @@ Details
[--embed-lyrics]
[--group]
[--embed-art]
[--debug]
bandcamp-dl (-h | --help)
bandcamp-dl (--version)
Options
=======
-------
::
@ -78,10 +80,9 @@ Options
-e --embed-lyrics Embed track lyrics (If available)
-g --group Use album/track Label as iTunes grouping
-r --embed-art Embed album art (If available)
-u --debug Log debug information to a file
Filename Template
=================
-----------------
The ``--template`` option allows users to indicate a template for the
output file names and directories. Templates can be built using special
@ -96,7 +97,7 @@ tokens:
The default template is: ``%{artist}/%{album}/%{track} - %{title}``.
Bugs
====
----
Bugs should be reported `here <https://github.com/iheanyi/bandcamp-dl/issues>`_.
Please include the URL and/or options used.
@ -107,14 +108,14 @@ When you submit a request, please re-read it once to avoid a couple of
mistakes (you can and should use this as a checklist):
Are you using the latest version?
=================================
---------------------------------
This should report that you're up-to-date. About 20% of the reports we
receive are already fixed, but people are using outdated versions. This
goes for feature requests as well.
Is the issue already documented?
================================
--------------------------------
Make sure that someone has not already opened the issue you're trying to
open. Search at the top of the window or at
@ -125,7 +126,7 @@ information on the issue: ...". While some issues may be old, a new post
into them often spurs rapid activity.
Why are existing options not enough?
====================================
------------------------------------
Before requesting a new feature, please have a quick peek at `the list
of supported
@ -135,7 +136,7 @@ Please, absolutely do show off your work in the issue report and detail
how the existing similar options do *not* solve your problem.
Does the issue involve one problem, and one problem only?
=========================================================
---------------------------------------------------------
Some of our users seem to think there is a limit of issues they can or
should open. There is no limit of issues they can or should open. While
@ -146,7 +147,7 @@ to the ticket lingering since nobody wants to attack that behemoth,
until someone mercifully splits the issue into multiple ones.
Is anyone going to need the feature?
====================================
------------------------------------
Only post features that you (or an incapable friend you can
personally talk to) require. Do not post features because they seem like
@ -154,7 +155,7 @@ a good idea. If they are really useful, they will be requested by
someone who requires them.
Is your question about bandcamp-dl?
===================================
-----------------------------------
It may sound strange, but some bug reports we receive are completely
unrelated to bandcamp-dl and relate to a different or even the
@ -165,7 +166,7 @@ hand, if your UI for bandcamp-dl fails in some way you believe is
related to bandcamp-dl, by all means, go ahead and report the bug.
Dependencies
============
------------
- `BeautifulSoup4 <https://pypi.python.org/pypi/beautifulsoup4>`_ - HTML Parsing
- `Demjson <https://pypi.python.org/pypi/demjson>`_- JavaScript dict to JSON conversion
@ -180,7 +181,7 @@ Dependencies
- `PBR <https://pypi.python.org/pypi/pbr>`_ - Setuptools injection library required by Mock
Copyright
=========
---------
bandcamp-dl is released into the public domain by the copyright holders

View File

@ -60,7 +60,7 @@ from bandcamp_dl.bandcampdownloader import BandcampDownloader
def main():
arguments = docopt(__doc__, version='bandcamp-dl 0.0.8')
arguments = docopt(__doc__, version='bandcamp-dl 0.0.8-1')
bandcamp = Bandcamp()
@ -95,7 +95,7 @@ def main():
else:
bandcamp_downloader = BandcampDownloader(url, arguments['--template'], basedir, arguments['--overwrite'],
arguments['--embed-lyrics'], arguments['--group'],
arguments['--embed-art'], arguments['--debug'])
arguments['--embed-art'])
bandcamp_downloader.start(album)

View File

@ -9,8 +9,8 @@ from bandcamp_dl.bandcampjson import BandcampJSON
class Bandcamp:
def __init__(self, debug=False):
self.debug = debug
def __init__(self):
self.headers = {'User-Agent': 'bandcamp-dl/0.0.8-1 (https://github.com/iheanyi/bandcamp-dl)'}
def parse(self, url: str, art: bool=True) -> dict or None:
"""Requests the page, cherry picks album info
@ -20,7 +20,7 @@ class Bandcamp:
:return: album metadata
"""
try:
response = requests.get(url)
response = requests.get(url, headers=self.headers)
except requests.exceptions.MissingSchema:
return None

View File

@ -24,7 +24,7 @@ class BandcampDownloader:
:param directory: download location
:param overwrite: if True overwrite existing files
"""
self.headers = {'user_agent': 'bandcamp-dl/0.0.8 (https://github.com/iheanyi/bandcamp-dl)'}
self.headers = {'User-Agent': 'bandcamp-dl/0.0.8-1 (https://github.com/iheanyi/bandcamp-dl)'}
self.session = requests.Session()
if type(urls) is str:
@ -117,7 +117,7 @@ class BandcampDownloader:
if album['art'] and not os.path.exists(dirname + "/cover.jpg"):
try:
with open(dirname + "/cover.jpg", "wb") as f:
r = self.session.get(album['art'])
r = self.session.get(album['art'], headers=self.headers)
f.write(r.content)
self.album_art = dirname + "/cover.jpg"
except Exception as e:

View File

@ -10,7 +10,7 @@ here = path.abspath(path.dirname(__file__))
setup(
name='bandcamp-downloader',
version='0.0.8',
version='0.0.8-1',
description='bandcamp-dl downloads albums and tracks from Bandcamp for you',
long_description=open('README.rst').read(),
url='https://github.com/iheanyi/bandcamp-dl',