mirror of
https://github.com/wassname/FanFicFare.git
synced 2026-09-13 12:11:20 +08:00
Add twilighted.net(not com) to downaloder.py so it actually *works*. Add one-shot support for twilighted.net.
This commit is contained in:
+2
-1
@@ -20,6 +20,7 @@ import output
|
||||
import adapter
|
||||
import fictionalley
|
||||
import hpfiction
|
||||
import twilighted
|
||||
|
||||
import time
|
||||
|
||||
@@ -88,7 +89,7 @@ if __name__ == '__main__':
|
||||
adapter = ffnet.FFNet(url)
|
||||
elif url.find('harrypotterfanfiction.com') != -1:
|
||||
adapter = hpfiction.HPFiction(url)
|
||||
elif url.find('twilighted.com') != -1:
|
||||
elif url.find('twilighted.net') != -1:
|
||||
adapter = twilighted.Twilighted(url)
|
||||
else:
|
||||
print >> sys.stderr, "Oi! I can haz not appropriate adapter for URL %s!" % url
|
||||
|
||||
+10
-6
@@ -74,13 +74,17 @@ class Twilighted(FanfictionSiteAdapter):
|
||||
self.authorName = title.split(' by ')[1].strip()
|
||||
|
||||
select = soup.find('select', { 'name' : 'chapter' } )
|
||||
|
||||
allOptions = select.findAll('option')
|
||||
|
||||
result = []
|
||||
for o in allOptions:
|
||||
url = self.url + "&chapter=%s" % o['value']
|
||||
title = o.string
|
||||
result.append((url,title))
|
||||
if select is None:
|
||||
# no chapters found, try url by itself.
|
||||
result.append((self.url,self.storyName))
|
||||
else:
|
||||
allOptions = select.findAll('option')
|
||||
for o in allOptions:
|
||||
url = self.url + "&chapter=%s" % o['value']
|
||||
title = o.string
|
||||
result.append((url,title))
|
||||
|
||||
return result
|
||||
|
||||
|
||||
Reference in New Issue
Block a user