michael-k-stein / spotifile Goto Github PK
View Code? Open in Web Editor NEWSpotify scraper
Spotify scraper
I exported cookies:
export SP_DC="xxx"
export SP_KEY="xxx"
python main.py
Then firefox pop-up, I paste a playlist, then click download button, I get in the web UI:
Full download exception: Expecting value: line 1 column 1 (char 0)
In cli, between HTTP logs, I have
Access token is anon: False
The Web GUI is up and running with a confirmed access token generated.
When trying to download songs, artists, playlists, etc., via direct URL, this error shows up on the bottom of the web GUI:
2023-04-07 09:14:09 | Recieved scrape command on identifier: https://open.spotify.com/track/4cOdK2wGLETKBW3PvgPWqT, recursive=False, recursive_artist=False, recursive_album=False
2023-04-07 09:14:09 | Thread<123145570799616> | Exception: Expecting value: line 1 column 1 (char 0)
2023-04-07 09:14:09 | Thread<123145570799616> | Processed 1 tracks
2023-04-07 09:14:09 | Comletely done scraping identifier: https://open.spotify.com/track/4cOdK2wGLETKBW3PvgPWqT!
At this point, there was no track downloaded (not in save folder nor temp folder).
When trying to download songs by category, this error shows up in the web GUI window:
Access token is anon: False
127.0.0.1 - - [07/Apr/2023 09:18:37] "GET /info/console/?offset=52 HTTP/1.1" 200 -
127.0.0.1 - - [07/Apr/2023 09:18:37] "POST /actions/download/categories HTTP/1.1" 500 -
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/init.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/flask/app.py", line 2551, in call
return self.wsgi_app(environ, start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/flask/app.py", line 2531, in wsgi_app
response = self.handle_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/flask/app.py", line 2528, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/flask/app.py", line 1825, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/flask/app.py", line 1823, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/flask/app.py", line 1799, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sasquelch/Documents/SpotiFile/webgui.py", line 36, in actions_download_categories
download_all_categories_playlists(download_meta_data_only=False, query=query)
File "/Users/sasquelch/Documents/SpotiFile/spotify_mass_download.py", line 158, in download_all_categories_playlists
client.refresh_tokens()
File "/Users/sasquelch/Documents/SpotiFile/spotify_client.py", line 39, in refresh_tokens
self.get_tokens(self.dc, self.key)
File "/Users/sasquelch/Documents/SpotiFile/spotify_client.py", line 33, in get_tokens
self._client_token = self.get_client_token(self._client_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/sasquelch/Documents/SpotiFile/spotify_client.py", line 60, in get_client_token
return response.json()['granted_token']['token']
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/requests/models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
127.0.0.1 - - [07/Apr/2023 09:18:37] "GET /actions/download/categories?debugger=yes&cmd=resource&f=debugger.js HTTP/1.1" 304 -
127.0.0.1 - - [07/Apr/2023 09:18:37] "GET /actions/download/categories?debugger=yes&cmd=resource&f=style.css HTTP/1.1" 304 -
127.0.0.1 - - [07/Apr/2023 09:18:37] "GET /actions/download/categories?debugger=yes&cmd=resource&f=console.png HTTP/1.1" 304 -
The POST request to "https://clienttoken.spotify.com/v1/clienttoken" is always empty. This causes me to get the error: "'https://clienttoken.spotify.com/v1/clienttoken". I believe that I have the sp_dc and sp_adid set up correctly. Did the url for the POST request change? Any help would be appreciated.
pip3 install -r requirements.txt
python3 main.py
Traceback (most recent call last):
File "/Users/Downloads/SpotiFile/main.py", line 2, in <module>
from webgui import app
File "/Users/Downloads/SpotiFile/webgui.py", line 4, in <module>
from spotify_mass_download import full_download, console, download_all_categories_playlists
File "/Users/Downloads/SpotiFile/spotify_mass_download.py", line 15, in <module>
client.get_me()
File "/Users/Downloads/SpotiFile/spotify_client.py", line 92, in get_me
raise SpotifyClientException('THIS USER IS PREMIUM!')
exceptions.SpotifyClientException: THIS USER IS PREMIUM!
I'm pretty sure I'm just doing something wrong but when I run main.py it gives me an import error of 'cannot import name 'urlencode' from 'urllib'. I'm using python 3.10, and all the dependencies noted in the requirements file are installed.
Using the command to install requirements (pip install -r ./requirements.txt or pip install -r ./requirements) results in the error:
ERROR: Could not find a version that satisfies the requirement rich (from py-deezer->-r ./requirements.txt (line 2)) (from versions: none)
ERROR: No matching distribution found for rich (from py-deezer->-r ./requirements.txt (line 2))
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.