diff --git a/ehentai_metadata/__init__.py b/ehentai_metadata/__init__.py index a15d368..db70db4 100644 --- a/ehentai_metadata/__init__.py +++ b/ehentai_metadata/__init__.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai from __future__ import (unicode_literals, division, absolute_import, print_function) @@ -13,7 +13,7 @@ import re import json -from urllib import urlencode +from urllib.parse import urlencode def to_metadata(log,gmetadata,ExHentai_Status): # {{{ title = gmetadata['title'] @@ -154,8 +154,7 @@ def build_term(type,parts): if author_token: q = q + (' ' if q != '' else '') + build_term('author', author_token) q = q.strip() - if isinstance(q, unicode): - q = q.encode('utf-8') + if not q: return None q_dict = {'f_doujinshi':1, 'f_manga':1, 'f_artistcg':1, 'f_gamecg':1, 'f_western':1, 'f_non-h':1, @@ -264,7 +263,7 @@ def identify(self, log, result_queue, abort, title=None, authors=None,identifier br.set_cookie(name=cookie['name'], value=cookie['value'], domain=cookie['domain'], path=cookie['path']) try: _raw = br.open_novisit(query,timeout=timeout) - raw = _raw.read() + raw = str(_raw.read()) except Exception as e: log.exception('Failed to make identify query: %r'%query) return as_unicode(e)