View Single Post
Old 03-28-2009, 05:07 PM   #396
ilovejedd
hopeless n00b
ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.
 
ilovejedd's Avatar
 
Posts: 5,110
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
FanFiction.Net is actually pretty adaptible to the current recipe system assuming you only want to download collections/omnibus of newly updated fanfics. It already has RSS feeds so there's no need to manually parse for article/story links. The above recipe can also be used to retrieve all stories by an author or in a C2 Community.

I don't think a Python-only recipe would be too difficult to accomplish for someone who's already familiar with the language. It's just hard for me since I'm not familiar with the syntax and built-in functions.
Quote:
Originally Posted by Hypernova View Post
Thanks for all the help, especially ilovejedd. I'll use your method if I get too lazy to do Copy & Paste to Word.
You're welcome. What end format do you need to convert to by the way? html, epub, or something else? The script I attached can be used in commandline mode to download individual stories. If you have Calibre installed, you can even have it converted to epub or lrf. erayd (the original author of the script) had a web service for downloading fanfics from FF.Net but it's been down for the past few days.

Addendum:
I fixed the PHP script (found a bunch of character conversion errors) and uploaded it to my webhost. Well, whaddya know, it works. The following recipe should be a good enough stop-gap until someone can convert the chapter retrieval logic into pure Python. The zip file in the original message message has also been replaced with the fixed PHP scripts.

Recipe for online server:
Code:
#!/usr/bin/env  python

__license__   = 'GPL v3'
__copyright__ = '2009, tifa1984'
'''
www.fanfiction.net
'''

import string, re
from calibre.web.feeds.news import BasicNewsRecipe

class FFNetFeed(BasicNewsRecipe):
    title          = u'FFNetFeed'
    __author__     = 'FanFiction.Net'
    description    = 'unleash your imagination'
    
    oldest_article = 1
    
    feeds          = [
                      ('Just In', 'http://www.fanfiction.net/atom/j/0/0/0/'),
                      ('Inuyasha - Inuyasha/Kagome', 'http://www.fanfiction.net/atom/l/436/10/0/1/1/0/646/647/0/0/'),
                      ('Inuyasha - Sesshoumaru/Kagome', 'http://www.fanfiction.net/atom/l/436/10/0/1/1/0/650/647/0/0/'),
                      ('Rurouni Kenshin - Kaoru/Kenshin', 'http://www.fanfiction.net/atom/l/355/10/0/1/1/0/410/411/0/0/')
                     ]
    
    def get_cover_url(self):
        self.cover_url = u'http://utterlyinsane.org/fflag/ffnetlogo.png'
        cover = self.cover_url
        return cover
    
    def print_version(self, url):
        main, sep, rest = url.rpartition('/1/')
        rmain, rsep, storyid = main.rpartition('/s/')
        return 'http://utterlyinsane.org/fflag/print.php?storyid=' + storyid
Notes:
  • users need to change the feeds to whatever categories they follow
  • I have the recipe scheduled to download everyday in Calibreso the default is to download all stories updated within 1 day, just modify oldest_article = 1 to reflect your downloading schedule
  • if downloading all stories by an author, you might want to change oldest_article to a really high value, e.g. 32767
  • downloading a whole bunch of stories might take a while so if you're downloading from a very active category (e.g. Harry Potter), you might want to limit the number of downloads or filter the RSS feed as much as possible (FanFiction.Net RSS feeds change based on the selected filters: genre, fiction rating, language, length, character, status)

Last edited by ilovejedd; 03-29-2009 at 03:58 PM.
ilovejedd is offline