From 10423af8ff93cc381f208ba9a367da3eaa449382 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Sun, 28 Oct 2012 12:05:51 -0500 Subject: [PATCH] Fix for bad auth on twiwritenet with some skins. --- fanficdownloader/adapters/adapter_twiwritenet.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fanficdownloader/adapters/adapter_twiwritenet.py b/fanficdownloader/adapters/adapter_twiwritenet.py index fd456cc..cf417ec 100644 --- a/fanficdownloader/adapters/adapter_twiwritenet.py +++ b/fanficdownloader/adapters/adapter_twiwritenet.py @@ -139,12 +139,14 @@ class TwiwriteNetSiteAdapter(BaseSiteAdapter): # use BeautifulSoup HTML parser to make everything easier to find. soup = bs.BeautifulSoup(data) + pagetitlediv = soup.find('div',id='pagetitle') + ## Title - a = soup.find('a', href=re.compile(r'viewstory.php\?sid='+self.story.getMetadata('storyId')+"$")) + a = pagetitlediv.find('a', href=re.compile(r'viewstory.php\?sid='+self.story.getMetadata('storyId')+"$")) self.story.setMetadata('title',a.string) # Find authorid and URL from... author url. - a = soup.find('a', href=re.compile(r"viewuser.php\?uid=\d+")) + a = pagetitlediv.find('a', href=re.compile(r"viewuser.php\?uid=\d+")) self.story.setMetadata('authorId',a['href'].split('=')[1]) self.story.setMetadata('authorUrl','http://'+self.host+'/'+a['href']) self.story.setMetadata('author',a.string)