|  03-28-2009, 12:08 PM | #391 | 
| Guru            Posts: 800 Karma: 194644 Join Date: Dec 2007 Location: Argentina Device: Kindle Voyage | 
			
			You are on your own here. I'm not interested in doing this recipe. Ask Kovid.
		 | 
|   | 
|  03-28-2009, 12:37 PM | #392 | 
| creator of calibre            Posts: 45,604 Karma: 28548974 Join Date: Oct 2006 Location: Mumbai, India Device: Various | 
			
			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.
		 | 
|   | 
|  03-28-2009, 01:37 PM | #393 | ||
| hopeless n00b            Posts: 5,126 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 | Quote: 
 Quote: 
 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=' + storyidCode: extension=php_curl.dll
extension=php_tidy.dllLast edited by ilovejedd; 03-29-2009 at 03:58 PM. | ||
|   | 
|  03-28-2009, 03:33 PM | #394 | 
| creator of calibre            Posts: 45,604 Karma: 28548974 Join Date: Oct 2006 Location: Mumbai, India Device: Various | 
			
			I am going to hold off on looking at this as I plan to eventually implement a general famework in calibre for getting non-periodical online content, like the recipe system, but one that supports getting lists of available content, searching, etc. When that happens, it should be relatively easy to add support for ff.net
		 | 
|   | 
|  03-28-2009, 04:23 PM | #395 | |
| Hyperreader            Posts: 130 Karma: 28678 Join Date: Feb 2009 Device: Current: Boox Leaf2 (broken) Past: H2O, Kindle PW1, DXG;Pocketbook 360 | 
			
			Thanks for all the help, especially ilovejedd.  I'll use your method if I get too lazy to do Copy & Paste to Word. Quote: 
 | |
|   | 
|  03-28-2009, 05:07 PM | #396 | |
| hopeless n00b            Posts: 5,126 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: 
  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
 Last edited by ilovejedd; 03-29-2009 at 03:58 PM. | |
|   | 
|  03-29-2009, 03:17 AM | #397 | 
| Hyperreader            Posts: 130 Karma: 28678 Join Date: Feb 2009 Device: Current: Boox Leaf2 (broken) Past: H2O, Kindle PW1, DXG;Pocketbook 360 | 
			
			Wow.  I just try your script ilovejedd.  Working great.  Now my PRS-505 is even more useful.  Thank you again. So this recipe is using your server right? Is it alright for me to keep using it? I think I can set up a php server if I really try, but I am no expert in the topic. | 
|   | 
|  03-29-2009, 08:06 AM | #398 | 
| Junior Member  Posts: 3 Karma: 10 Join Date: Mar 2009 Device: PRS-505 | 
			
			I would appreciate if someone can come up with a recipe for La Prensa -- www.laprensa.com.ni/archivo/noticias/rss/ Thank you | 
|   | 
|  03-29-2009, 11:12 AM | #399 | |
| Junior Member  Posts: 9 Karma: 10 Join Date: Apr 2008 Device: iRex DR1000S | 
				
				Presse recipe
			 Quote: 
 --------- Job: **Fetch news from DiePresse** **tuple**: ('OEBError', u"File 'feed_0/article_4/index.html' does not appear to be (X)HTML") **Traceback**: Traceback (most recent call last): File "/Applications/calibre.app/Contents/console.app/Contents/Resources/lib/python2.6/site-packages.zip/calibre/parallel.py", line 958, in worker result = work(client_socket, func, args, kwdargs) File "/Applications/calibre.app/Contents/console.app/Contents/Resources/lib/python2.6/site-packages.zip/calibre/parallel.py", line 916, in work etc.... -------- the recipe is as simple as: [CODE]class AdvancedUserRecipe1238335231(BasicNewsRecipe): title = u'DiePresse' oldest_article = 2 max_articles_per_feed = 10 feeds = [(u'home', u'http://diepresse.com/rss/home'), ] def print_version(self,url): return url.replace('index.do?from=rss', 'print.do') [CODE] this recipe works but if you replace the feed "home" with any other like "sport" or "kultur" it stops working with the above mentioned error. | |
|   | 
|  03-29-2009, 12:52 PM | #400 | |
| hopeless n00b            Posts: 5,126 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 | Quote: 
  Just yesterday, I had to do a couple of fixes because of the way FanFiction.Net changed handling of crossovers. I like the new system, I do, but it was a pain trying to figure out why some fanfics won't download but others do. A few days before that, I was fixing another script (this one is for dynamic browsing of selected categories on FF.Net from Stanza iPhone) because they added pairing information. | |
|   | 
|  03-29-2009, 01:29 PM | #401 | |
| Guru            Posts: 800 Karma: 194644 Join Date: Dec 2007 Location: Argentina Device: Kindle Voyage | Quote: 
 | |
|   | 
|  03-29-2009, 02:01 PM | #402 | 
| creator of calibre            Posts: 45,604 Karma: 28548974 Join Date: Oct 2006 Location: Mumbai, India Device: Various | 
			
			@donCalpe That's because those feeds produce pages that look like this Code: <!-- Bottom build 2.30 --> <!-- Setup build 3.03 --> <!-- Kontingent hashmap build 2.52 --> <!-- Regroup hashmap build 2.45 --> <!-- Level2 hashmap build 1.18 --> <!-- Sitestat build 2.39 --> <!-- End Sitestat4 code --> <!-- Ohters build 2.21 --> <!-- FragebogenOEWA --> <!-- /FragebogenOEWA --> <!-- Begin Sitestat4 Technical code --> <!-- End Sitestat4 Technical code --> java.lang.NullPointerException at java.util.regex.Matcher.getTextLength(Matcher.java:1140) at java.util.regex.Matcher.reset(Matcher.java:291) at java.util.regex.Matcher.<init>(Matcher.java:211) at java.util.regex.Pattern.matcher(Pattern.java:888) at org.apache.jsp.portal.services.article.print_jsp._jspService(print_jsp.java:125) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085) at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263) at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398) at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:318) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at at.beit.portal.tools.urlredirect.URLRedirectFilter.doFilter(URLRedirectFilter.java:120) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:425) at org.apache.coyote.ajp.AjpAprProtocol$AjpConnectionHandler.process(AjpAprProtocol.java:452) at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1285) at java.lang.Thread.run(Thread.java:619) </init> | 
|   | 
|  03-29-2009, 03:03 PM | #403 | 
| Guru            Posts: 800 Karma: 194644 Join Date: Dec 2007 Location: Argentina Device: Kindle Voyage | 
			
			Actually it was not that hard as I thought: La Prensa - Nicaragua | 
|   | 
|  03-29-2009, 03:32 PM | #404 | |
| Groupie            Posts: 186 Karma: 3633418 Join Date: Mar 2009 Location: UK Device: Kobo Libra | Quote: 
 I'm trying to run your script as I've been looking for something to do this with FFNet for a long time (it's a real pain having to cut and paste each page manually!) but every time I run it I get this error: Warning: require_once(source/.source.php) [function.require-once]: failed to open stream: No such file or directory in C:\xampp\htdocs\flag\getstory.php on line 55 Fatal error: require_once() [function.require]: Failed opening required 'source/.source.php' (include_path='.;C:\xampp\php\pear\') in C:\xampp\htdocs\flag\getstory.php on line 55 I know I'm probably doing something really stupid and I have tried searching on the net to no avail, so any insight you could give me would be much appreciated. I have to admit right from the start I know nothing about php and have only ever run basic web servers (though I do know php is running and is version 5.2.8) so I'm really clueless as to what to do here. TIA for any help you can give. Mnementh | |
|   | 
|  03-29-2009, 03:56 PM | #405 | |
| hopeless n00b            Posts: 5,126 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 | Quote: 
 Code: 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=' + storyidThe zip file should contain a print.php file which you can also use. That one automatically uses ffnet as source. Just change the recipe to the following: Code: def print_version(self, url):
    main, sep, rest = url.rpartition('/1/')
    rmain, rsep, storyid = main.rpartition('/s/')
    return 'http://localhost/flag/print.php?storyid=' + storyidLast edited by ilovejedd; 03-29-2009 at 04:07 PM. | |
|   | 
|  | 
| Thread Tools | Search this Thread | 
| 
 | 
|  Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| Custom column read ? | pchrist7 | Calibre | 2 | 10-04-2010 02:52 AM | 
| Archive for custom screensavers | sleeplessdave | Amazon Kindle | 1 | 07-07-2010 12:33 PM | 
| How to back up preferences and custom recipes? | greenapple | Calibre | 3 | 03-29-2010 05:08 AM | 
| Donations for Custom Recipes | ddavtian | Calibre | 5 | 01-23-2010 04:54 PM | 
| Help understanding custom recipes | andersent | Calibre | 0 | 12-17-2009 02:37 PM |