Quote:
Originally Posted by Hypernova
I tried to make a recipe for FanFiction.net. Well, unless it is a multiple chapters story, it is easy enough.
Code:
class FanFiction(BasicNewsRecipe):
title = u'FanFiction'
oldest_article = 7
max_articles_per_feed = 10
use_embedded_content = False
remove_javascript = True
keep_only_tags = [dict(name='div', attrs={'id':'storytext'})]
feeds = [(u'Just In', u'http://www.fanfiction.net/atom/j/0/0/0/')]
But I don't know what to do with multiple chapters story (example: http://www.fanfiction.net/s/4952058/1/Moonlight_Spell). I tried looking at Ars Technica recipe, but have no idea what's going on. Can I request a recipe that works for multiple chapters story as well? 
|
I have a working recipe but it involves running an HTTP server w/PHP on your PC. How comfortable are you with that?
Quote:
Originally Posted by kovidgoyal
I believe there is already a recipe posted for fanfiction.net somewhere on these forums by moggie, I don't recall if it supports multiple chapters.
|
Nah, that's for TheSugarQuill. Not very easy adapting it for FanFiction.Net. I tried and failed. Although, that probably has to do with my unfamiliarity with Python instead of any actual programming difficulty.
Recipe for those running a local 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 = [
('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://localhost/flag/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://localhost/flag/getstory.php?source=ffnet&format=news&storyid=' + storyid
Attached are the PHP scripts to create a printable version of a story. Easiest way to get it working would be to install
XAMPP. You need to enable the php curl and php tidy extensions. In XAMPP for Windows, I just had to uncomment the following lines from \xampp\apache\bin\php.ini:
Code:
extension=php_curl.dll
extension=php_tidy.dll