Mild fixes and integration for new adapters, bump versions.

This commit is contained in:
Jim Miller
2012-06-16 18:28:11 -05:00
parent 1ce45cfe5c
commit fc7b53e290
9 changed files with 113 additions and 11 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
# ffd-retief-hrd fanfictiondownloader
application: fanfictiondownloader
version: 4-4-15
version: 4-4-16
runtime: python27
api_version: 1
threadsafe: true
+19
View File
@@ -425,6 +425,9 @@ cover_exclusion_regexp:/images/.*?ribbon.gif
## personal.ini, not defaults.ini.
#is_adult:true
[samdean.archive.nu]
[stargate-atlantis.org]
[thehexfiles.net]
@@ -447,6 +450,8 @@ cover_exclusion_regexp:/images/.*?ribbon.gif
## this should go in your personal.ini, not defaults.ini.
#is_adult:true
[www.thealphagate.com]
[www.archiveofourown.org]
## Some sites do not require a login, but do require the user to
## confirm they are adult for adult content. In commandline version,
@@ -461,6 +466,12 @@ cover_exclusion_regexp:/images/.*?ribbon.gif
#username:YourName
#password:yourpassword
[www.destinysgateway.com]
## Some sites do not require a login, but do require the user to
## confirm they are adult for adult content. In commandline version,
## this should go in your personal.ini, not defaults.ini.
#is_adult:true
[www.dokuga.com]
[www.fanfiction.net]
@@ -545,6 +556,8 @@ extratags:
## cover image. This lets you exclude them.
cover_exclusion_regexp:/stories/999/images/.*?_trophy.png
[www.ncisfiction.com]
[www.phoenixsong.net]
## Some sites require login (or login for some rated stories) The
## program can prompt you, or you can save it in config. In
@@ -637,6 +650,12 @@ collect_series: false
## this should go in your personal.ini, not defaults.ini.
#is_adult:true
[www.yourfanfiction.com]
## Some sites do not require a login, but do require the user to
## confirm they are adult for adult content. In commandline version,
## this should go in your personal.ini, not defaults.ini.
#is_adult:true
[overrides]
## It may sometimes be useful to override all of the specific format,
## site and site:format sections in your private configuration. For
+1 -1
View File
@@ -17,7 +17,7 @@
import logging
## XXX cli option for logging level.
logging.basicConfig(level=logging.INFO,format="%(levelname)s:%(filename)s(%(lineno)d):%(message)s")
logging.basicConfig(level=logging.DEBUG,format="%(levelname)s:%(filename)s(%(lineno)d):%(message)s")
import sys, os
from os.path import normpath, expanduser, isfile, join
+6
View File
@@ -70,6 +70,12 @@ import adapter_iketernalnet
import adapter_onedirectionfanfictioncom
import adapter_prisonbreakficnet
import adapter_storiesofardacom
import adapter_yourfanfictioncom
import adapter_samdeanarchivenu
import adapter_destinysgatewaycom
import adapter_ncisfictioncom
import adapter_stargateatlantisorg
import adapter_thealphagatecom
## This bit of complexity allows adapters to be added by just adding
## importing. It eliminates the long if/else clauses we used to need
@@ -96,11 +96,27 @@ class DestinysGatewayComAdapter(BaseSiteAdapter):
else:
raise e
# The actual text that is used to announce you need to be an
# adult varies from site to site. Again, print data before
# the title search to troubleshoot.
if "This rating has graphic sexual scenes" in data:
raise exceptions.AdultCheckRequired(self.url)
m = re.search(r"'viewstory.php\?sid=\d+((?:&ageconsent=ok)?&warning=\d+)'",data)
if m != None:
if self.is_adult or self.getConfig("is_adult"):
# We tried the default and still got a warning, so
# let's pull the warning number from the 'continue'
# link and reload data.
addurl = m.group(1)
# correct stupid & error in url.
addurl = addurl.replace("&","&")
url = self.url+'&index=1'+addurl
logging.debug("URL 2nd try: "+url)
try:
data = self._fetchUrl(url)
except urllib2.HTTPError, e:
if e.code == 404:
raise exceptions.StoryDoesNotExist(self.url)
else:
raise e
else:
raise exceptions.AdultCheckRequired(self.url)
if "Access denied. This story has not been validated by the adminstrators of this site." in data:
raise exceptions.FailedToDownload(self.getSiteDomain() +" says: Access denied. This story has not been validated by the adminstrators of this site.")
@@ -69,11 +69,15 @@ class SamDeanArchiveNuAdapter(BaseSiteAdapter):
# The site domain. Does have www here, if it uses it.
return 'samdean.archive.nu'
@classmethod
def getAcceptDomains(cls):
return ['www.samdean.archive.nu','samdean.archive.nu']
def getSiteExampleURLs(self):
return "http://"+self.getSiteDomain()+"/viewstory.php?sid=1234"
def getSiteURLPattern(self):
return re.escape("http://"+self.getSiteDomain()+"/viewstory.php?sid=")+r"\d+$"
return re.escape("http://")+r"(www\.)?"+re.escape(self.getSiteDomain()+"/viewstory.php?sid=")+r"\d+$"
## Getting the chapter list and the meta data, plus 'is adult' checking.
def extractChapterUrlsAndMetadata(self):
@@ -57,7 +57,7 @@ class YourFanfictionComAdapter(BaseSiteAdapter):
# The date format will vary from site to site.
# http://docs.python.org/library/datetime.html#strftime-strptime-behavior
self.dateformat = "%d/%b/%y"
self.dateformat = "%d %b %Y"
@staticmethod # must be @staticmethod, don't remove it.
def getSiteDomain():
+39 -2
View File
@@ -56,7 +56,12 @@
<!-- put announcements here, h3 is a good title size. -->
<h3>New Sites</h3>
<p>
New sites onedirectionfanfiction.com, www.prisonbreakfic.net and www.storiesofarda.com added. Thanks, Ida.
New sites samdean.archive.nu, www.yourfanfiction.com,
www.destinysgateway.com, www.thealphagate.com,
stargate-atlantis.org and www.ncisfiction.com added.
That's 51 different supported sites now. Thanks, Ida!
</p>
<p>
Questions? Check out our
@@ -66,7 +71,7 @@
If you have any problems with this application, please
report them in
the <a href="http://groups.google.com/group/fanfic-downloader">FanFictionDownLoader Google Group</a>. The
<a href="http://4-4-14.fanfictiondownloader.appspot.com">Previous Version</a> is also available for you to use if necessary.
<a href="http://4-4-15.fanfictiondownloader.appspot.com">Previous Version</a> is also available for you to use if necessary.
</p>
<div id='error'>
{{ error_message }}
@@ -384,6 +389,38 @@
Use the URL of the story's chapter list, such as
<br /><a href="http://www.storiesofarda.com/chapterlistview.asp?SID=7000">http://www.storiesofarda.com/chapterlistview.asp?SID=7000</a>
</dd>
<dt>samdean.archive.nu</dt>
<dd>
Use the URL of the story's first chapter, such as
<br /><a href="http://samdean.archive.nu/viewstory.php?sid=1234">http://samdean.archive.nu/viewstory.php?sid=1234</a>
</dd>
<dt>www.yourfanfiction.com</dt>
<dd>
Use the URL of the story's first chapter, such as
<br /><a href="http://www.yourfanfiction.com/viewstory.php?sid=1234">http://www.yourfanfiction.com/viewstory.php?sid=1234</a>
</dd>
<dt>www.destinysgateway.com</dt>
<dd>
Use the URL of the story's first chapter, such as
<br /><a href="http://www.destinysgateway.com/viewstory.php?sid=1234">http://www.destinysgateway.com/viewstory.php?sid=1234</a>
</dd>
<dt>www.thealphagate.com</dt>
<dd>
Use the URL of the story's first chapter, such as
<br /><a href="http://www.thealphagate.com/viewstory.php?sid=1234">http://www.thealphagate.com/viewstory.php?sid=1234</a>
</dd>
<dt>stargate-atlantis.org</dt>
<dd>
Use the URL of the story's first chapter, such as
<br /><a href="http://stargate-atlantis.org/fanfics/viewstory.php?sid=1234">http://stargate-atlantis.org/fanfics/viewstory.php?sid=1234</a>
</dd>
<dt>www.ncisfiction.com</dt>
<dd>
Use the URL of the story's first chapter, such as
<br /><a href="http://www.ncisfiction.com/story.php?stid=1234">http://www.ncisfiction.com/story.php?stid=1234</a>
Or use the URL of the story's chapter list, such as
<br /><a href="http://www.ncisfiction.com/chapters.php?stid=1234">http://www.ncisfiction.com/chapters.php?stid=1234</a>
</dd>
</dl>
<p>
A few additional things to know, which will make your life substantially easier:
+20
View File
@@ -411,6 +411,10 @@ cover_exclusion_regexp:/images/.*?ribbon.gif
## personal.ini, not defaults.ini.
#is_adult:true
[samdean.archive.nu]
[stargate-atlantis.org]
[thehexfiles.net]
[thequidditchpitch.org]
@@ -432,6 +436,8 @@ cover_exclusion_regexp:/images/.*?ribbon.gif
## this should go in your personal.ini, not defaults.ini.
#is_adult:true
[www.thealphagate.com]
[www.archiveofourown.org]
## Some sites do not require a login, but do require the user to
## confirm they are adult for adult content. In commandline version,
@@ -446,6 +452,12 @@ cover_exclusion_regexp:/images/.*?ribbon.gif
#username:YourName
#password:yourpassword
[www.destinysgateway.com]
## Some sites do not require a login, but do require the user to
## confirm they are adult for adult content. In commandline version,
## this should go in your personal.ini, not defaults.ini.
#is_adult:true
[www.dokuga.com]
[www.fanfiction.net]
@@ -527,6 +539,8 @@ extratags:
## cover image. This lets you exclude them.
cover_exclusion_regexp:/stories/999/images/.*?_trophy.png
[www.ncisfiction.com]
[www.phoenixsong.net]
## Some sites require login (or login for some rated stories) The
## program can prompt you, or you can save it in config. In
@@ -619,6 +633,12 @@ collect_series: false
## this should go in your personal.ini, not defaults.ini.
#is_adult:true
[www.yourfanfiction.com]
## Some sites do not require a login, but do require the user to
## confirm they are adult for adult content. In commandline version,
## this should go in your personal.ini, not defaults.ini.
#is_adult:true
[overrides]
## It may sometimes be useful to override all of the specific format,
## site and site:format sections in your private configuration. For