Skip to content

Commit

Permalink
Fix: Use huaban instead of huabanpro as domain name
Browse files Browse the repository at this point in the history
  • Loading branch information
winkidney committed Mar 30, 2020
1 parent 53d7412 commit fd67070
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/picktrue/sites/huaban.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import re
from json import JSONDecodeError
from pprint import pformat

import os
Expand All @@ -15,7 +16,7 @@
from picktrue.utils import retry

IMAGE_URL_TPL = "http://img.hb.aicdn.com/{file_key}"
BASE_URL = "http://huabanpro.com"
BASE_URL = "http://huaban.com"

XHR_HEADERS = {
"X-Requested-With": "XMLHttpRequest",
Expand Down Expand Up @@ -54,7 +55,16 @@ def get(self, url, require_json=False, **kwargs):
kwargs.pop('timeout')
resp = self.session.get(url, timeout=(2, 30), **kwargs)
if require_json:
resp.json()
try:
resp.json()
except JSONDecodeError:
download_logger.error(
"Failed to convert resp to json for url {}: {}".format(
url,
resp.text,
)
)
raise
return resp

@staticmethod
Expand Down

0 comments on commit fd67070

Please sign in to comment.