diff --git a/irs/ripper.py b/irs/ripper.py index 7603a41..8993190 100644 --- a/irs/ripper.py +++ b/irs/ripper.py @@ -1,3 +1,5 @@ +# _*_ coding:utf-8 _*_ + # System import sys import os @@ -141,8 +143,8 @@ class Ripper: raise ValueError("Must specify song_title/artist in `args` with \ init, or in method arguments.") - search_terms = str(song) + " " + str(artist - ) + " " + str(additional_search) + search_terms = song + " " + artist + " " + additional_search + query_string = urlencode({"search_query": ( search_terms.encode('utf-8'))}) link = "http://www.youtube.com/results?" + query_string @@ -376,7 +378,11 @@ init, or in method arguments.") video_url, video_title = self.find_yt_url(song, artist) - print(self.args["hook-text"].get("song").format(song, artist)) + if sys.version_info[0] == 2: + print(self.args["hook-text"].get("song").decode().format(song, + artist)) + else: + print(self.args["hook-text"].get("song").format(song, artist)) file_name = data["file_prefix"] + ObjManip.blank(song, False) + ".mp3" diff --git a/irs/utils.py b/irs/utils.py index f5a0c8a..f1c7277 100644 --- a/irs/utils.py +++ b/irs/utils.py @@ -1,4 +1,5 @@ -# -*- coding: UTF-8 -*- +# _*_ coding:utf-8 _*_ + # ======= # Imports @@ -95,12 +96,16 @@ class ObjManip: # Object Manipulation return False def blank(string, downcase=True): - import re - regex = re.compile('[^a-zA-Z0-9\ ]') - string = regex.sub('', str(string)) if downcase: string = string.lower() - return ' '.join(string.split()) + import re + regex = re.compile('[^a-zA-Z0-9\ ]') + if sys.version_info == 2: + string = regex.sub('', string.decode("utf8")) + return ' '.join(string.decode().split()) + else: + string = regex.sub('', string) + return ' '.join(string.split()) def blank_include(this, includes_this): this = ObjManip.blank(this)