mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-10-29 18:00:15 +00:00
Use urllib2.quote() to fix encoding errors
This commit is contained in:
BIN
core/__pycache__/__init__.cpython-35.pyc
Normal file
BIN
core/__pycache__/__init__.cpython-35.pyc
Normal file
Binary file not shown.
BIN
core/__pycache__/metadata.cpython-35.pyc
Normal file
BIN
core/__pycache__/metadata.cpython-35.pyc
Normal file
Binary file not shown.
BIN
core/__pycache__/misc.cpython-35.pyc
Normal file
BIN
core/__pycache__/misc.cpython-35.pyc
Normal file
Binary file not shown.
@@ -4,6 +4,11 @@ import os
|
||||
from slugify import slugify
|
||||
import spotipy.oauth2 as oauth2
|
||||
|
||||
try:
|
||||
from urllib2 import quote
|
||||
except:
|
||||
from urllib.request import quote
|
||||
|
||||
def input_link(links):
|
||||
while True:
|
||||
try:
|
||||
@@ -71,8 +76,7 @@ def generate_token():
|
||||
return token
|
||||
|
||||
def generate_search_URL(song):
|
||||
URL = "https://www.youtube.com/results?sp=EgIQAQ%253D%253D&q=" + \
|
||||
song.replace(" ", "%20")
|
||||
URL = "https://www.youtube.com/results?sp=EgIQAQ%253D%253D&q=" + quote(song)
|
||||
return URL
|
||||
|
||||
def fix_encoding(query):
|
||||
|
||||
@@ -22,7 +22,7 @@ def generate_songname(raw_song):
|
||||
if misc.is_spotify(raw_song):
|
||||
tags = generate_metadata(raw_song)
|
||||
raw_song = tags['artists'][0]['name'] + ' - ' + tags['name']
|
||||
return raw_song
|
||||
return misc.fix_encoding(raw_song)
|
||||
|
||||
def generate_metadata(raw_song):
|
||||
if misc.is_spotify(raw_song):
|
||||
|
||||
Reference in New Issue
Block a user