Merge pull request #30 from kepoorhampond/issue-14

Apparently it was just some wierd apostrophe in a unicode format
This commit is contained in:
Kepoor Hampond 2017-06-10 19:01:29 -07:00 committed by GitHub
commit 24f3681b36
2 changed files with 19 additions and 8 deletions

View file

@ -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"

View file

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