Skip to content

Commit

Permalink
Fix #98
Browse files Browse the repository at this point in the history
Handle a few patreon corner-cases.
  • Loading branch information
fake-name committed Jul 15, 2020
1 parent 28750f2 commit d7ec066
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion xascraper/modules/fa/faScrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def getCookie(self):

if not solver:
self.log.error("No captcha solver configured (or no solver with a non-zero balance)! Cannot continue!")
return "Login Failed"
return False, "Login Failed"


login_pg = self.wg.getpage('https://www.furaffinity.net/login/?mode=imagecaptcha')
Expand Down
21 changes: 19 additions & 2 deletions xascraper/modules/patreon/patreonScrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ def save_json(self, aname, itemid, filecontent):
os.makedirs(fqpath)
fqpath = os.path.join(fqpath, 'itemid-{id}.pyson'.format(id=itemid))
with open(fqpath, "wb") as fp:
fstr = pprint.pformat(filecontent)
# fstr = pprint.pformat(filecontent)
fp.write(fstr.encode("utf-8"))

def save_image(self, aname, pid, fname, furl):
Expand Down Expand Up @@ -483,6 +483,23 @@ def _get_art_post(self, postId, artistName):
"?include=media"
)

if 'status' in post and post['status'] == '404':
self.log.warning("Post is not found!")
fail = {
'status' : ''
}
return fail


if not 'data' in post:
self.log.warning("No 'data' member in post!")
pprint.pprint(post)
fail = {
'status' : ''
}
return fail


post_content = post['data']
post_info = post_content['attributes']

Expand Down Expand Up @@ -513,7 +530,7 @@ def _get_art_post(self, postId, artistName):
raise exceptions.CannotAccessException("You can't view that content!")

# if not 'content' in post_info:
pprint.pprint(post_content)
# pprint.pprint(post_content)

ret = {
'page_desc' : post_info['content'],
Expand Down

0 comments on commit d7ec066

Please sign in to comment.