python3 fixes
This commit is contained in:
parent
a7fe2e2f96
commit
3e9a7c2e5f
2 changed files with 3 additions and 3 deletions
|
@ -802,7 +802,7 @@ def get_episodes(imdbId, season=None):
|
||||||
|
|
||||||
def max_votes():
|
def max_votes():
|
||||||
url = 'http://www.imdb.com/search/title?num_votes=500000,&sort=num_votes,desc'
|
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([
|
votes = max([
|
||||||
int(v.replace(',', ''))
|
int(v.replace(',', ''))
|
||||||
for v in re.compile('<span name="nv" data-value="(\d+)"').findall(data)
|
for v in re.compile('<span name="nv" data-value="(\d+)"').findall(data)
|
||||||
|
|
|
@ -116,7 +116,7 @@ def get_movie_data(wikipedia_url):
|
||||||
|
|
||||||
def get_image_url(name):
|
def get_image_url(name):
|
||||||
url = 'http://en.wikipedia.org/wiki/Image:' + name.replace(' ', '%20')
|
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/.*?)"')
|
url = find_re(data, 'href="(http://upload.wikimedia.org/.*?)"')
|
||||||
if not url:
|
if not url:
|
||||||
url = find_re(data, 'href="(//upload.wikimedia.org/.*?)"')
|
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)
|
url = "http://en.wikipedia.org/w/api.php?" + urllib.parse.urlencode(query)
|
||||||
data = read_url(url)
|
data = read_url(url)
|
||||||
if not data:
|
if not data:
|
||||||
data = read_url(url, timeout=0)
|
data = read_url(url, timeout=0)
|
||||||
result = json.loads(data.decode('utf-8'))
|
result = json.loads(data.decode('utf-8'))
|
||||||
results = []
|
results = []
|
||||||
if result and 'query' in result:
|
if result and 'query' in result:
|
||||||
|
|
Loading…
Reference in a new issue