python3 fixes

This commit is contained in:
j 2016-09-07 15:06:52 +02:00
parent a7fe2e2f96
commit 3e9a7c2e5f
2 changed files with 3 additions and 3 deletions

View file

@ -802,7 +802,7 @@ def get_episodes(imdbId, season=None):
def max_votes():
url = 'http://www.imdb.com/search/title?num_votes=500000,&sort=num_votes,desc'
data = cache.read_url(url)
data = cache.read_url(url).decode('utf-8', 'ignore')
votes = max([
int(v.replace(',', ''))
for v in re.compile('<span name="nv" data-value="(\d+)"').findall(data)

View file

@ -116,7 +116,7 @@ def get_movie_data(wikipedia_url):
def get_image_url(name):
url = 'http://en.wikipedia.org/wiki/Image:' + name.replace(' ', '%20')
data = read_url(url)
data = read_url(url).decode('utf-8')
url = find_re(data, 'href="(http://upload.wikimedia.org/.*?)"')
if not url:
url = find_re(data, 'href="(//upload.wikimedia.org/.*?)"')
@ -145,7 +145,7 @@ def find(query, max_results=10):
url = "http://en.wikipedia.org/w/api.php?" + urllib.parse.urlencode(query)
data = read_url(url)
if not data:
data = read_url(url, timeout=0)
data = read_url(url, timeout=0)
result = json.loads(data.decode('utf-8'))
results = []
if result and 'query' in result: