Use urllib2.quote() to fix encoding errors

This commit is contained in:
Ritiek
2017-06-16 20:53:30 +05:30
parent 1071eb3d75
commit 44f34555b4
5 changed files with 7 additions and 3 deletions

View File

@@ -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):