urlencode

This commit is contained in:
j 2014-10-05 10:23:56 +02:00
parent f630877098
commit 9b860d0d33

View file

@ -6,7 +6,7 @@ import re
import time import time
import unicodedata import unicodedata
from six.moves import urllib from six.moves.urllib.parse import urlencode
from six import string_types from six import string_types
from .. import find_re, strip_tags, decode_html from .. import find_re, strip_tags, decode_html
@ -665,7 +665,7 @@ def get_movie_by_title(title, timeout=-1):
params['q'] = unicodedata.normalize('NFKC', params['q']).encode('latin-1') params['q'] = unicodedata.normalize('NFKC', params['q']).encode('latin-1')
except: except:
params['q'] = params['q'].encode('utf-8') params['q'] = params['q'].encode('utf-8')
params = urllib.urlencode(params) params = urlencode(params)
url = "http://akas.imdb.com/find?" + params url = "http://akas.imdb.com/find?" + params
data = read_url(url, timeout=timeout, unicode=True) data = read_url(url, timeout=timeout, unicode=True)
#if search results in redirect, get id of current page #if search results in redirect, get id of current page
@ -741,7 +741,7 @@ def get_movie_id(title, director='', year='', timeout=-1):
params['q'] = unicodedata.normalize('NFKC', params['q']).encode('latin-1') params['q'] = unicodedata.normalize('NFKC', params['q']).encode('latin-1')
except: except:
params['q'] = params['q'].encode('utf-8') params['q'] = params['q'].encode('utf-8')
params = urllib.urlencode(params) params = urlencode(params)
url = "http://akas.imdb.com/find?" + params url = "http://akas.imdb.com/find?" + params
#print url #print url