Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes

Notices

Reply
 
Thread Tools Search this Thread
Old 01-19-2016, 01:51 AM   #1
failoversofa
Junior Member
failoversofa began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jan 2016
Device: x-platform
request - First recipe 99.9% complete (I hope)

So I'm new, there's a bit of a learning curve, but I have this so far:

github.com/TheNotary/calibre_recipe_eff

Upon debugging, the 'link' value is empty and can't be parsed. It treats the link element as `<link \> https://actual.link.com` which is obviously no good. I'm trying to parse an rss stream... maybe I'm accidentally using an html only parser or something?

Help would be sooo appreciated!
failoversofa is offline   Reply With Quote
Old 01-19-2016, 02:04 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
If you want to get articles from an rss feed, all you need is

feeds = ['url of feed']

dont implement parse_index
kovidgoyal is offline   Reply With Quote
Advert
Old 01-19-2016, 02:29 PM   #3
failoversofa
Junior Member
failoversofa began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jan 2016
Device: x-platform
It's important the articles appear in different 'sections', how do I override the default of them all showing up in the 'all articles' section?

Also thanks for making this application!!!
failoversofa is offline   Reply With Quote
Old 01-19-2016, 10:54 PM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Override parse_feeds and do whatever you like to postprocess the result of calling the base class parse_feeds()
kovidgoyal is offline   Reply With Quote
Old 01-20-2016, 12:49 AM   #5
failoversofa
Junior Member
failoversofa began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jan 2016
Device: x-platform
Have you ever considered defining a consumer centered DSL for defining the parsing of feeds in the clearest way possible and then implementing a system of converting a clearly written script into commands run against calibre? I feel like that might be a sharp way forward to allow end users to customize the manor in which their web content is rendered to eink friendly formats.

Quote:
Originally Posted by kovidgoyal View Post
Override parse_feeds and do whatever you like to postprocess the result of calling the base class parse_feeds()
I'm game for something like this, but it's all walls for me. What does calling parse_feeds on the base class look like in code?
failoversofa is offline   Reply With Quote
Advert
Old 01-20-2016, 01:16 AM   #6
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
No, IMO creating special purpose DSLs is a much harder to learn solution and much less flexible than using a well known and well designed programming language.

All you need to do is

Code:
    def parse_feeds(self):
          feeds = BasicNewsRecipe.parse_feeds(self)
          # do whatever you want with the feeds object, use print statements to see what it looks like
          return feeds
EDIT: Or if you prefer to work with parse_index, since ou've already started down that road, just use the python feedparser module to parse the RSS feed

Last edited by kovidgoyal; 01-20-2016 at 01:19 AM.
kovidgoyal is offline   Reply With Quote
Old 01-20-2016, 01:23 AM   #7
failoversofa
Junior Member
failoversofa began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jan 2016
Device: x-platform
Quote:
Originally Posted by kovidgoyal View Post
No, IMO creating special purpose DSLs is a much harder to learn solution and much less flexible than using a well known and well designed programming language.

All you need to do is

Code:
    def parse_feeds(self):
          feeds = BasicNewsRecipe.parse_feeds(self)
          # do whatever you want with the feeds object, use print statements to see what it looks like
          return feeds
Hmm. that line [inline]feeds = BasicNewsRecipe.parse_feeds(self)[/inline] seems to be throwing an error on my system.

Code:
$  ebook-convert eff.recipe .epub --test -vv --debug-pipeline debug
1% Converting input to HTML...
InputFormatPlugin: Recipe Input running
Using custom recipe
1% Fetching feeds...
Traceback (most recent call last):
  File "site.py", line 66, in main
  File "site-packages/calibre/ebooks/conversion/cli.py", line 360, in main
  File "site-packages/calibre/ebooks/conversion/plumber.py", line 1051, in run
  File "site-packages/calibre/customize/conversion.py", line 241, in __call__
  File "site-packages/calibre/ebooks/conversion/plugins/recipe_input.py", line 117, in convert
  File "site-packages/calibre/web/feeds/news.py", line 1029, in download
  File "site-packages/calibre/web/feeds/news.py", line 1199, in build_index
  File "<string>", line 41, in parse_feeds
  File "site-packages/calibre/web/feeds/news.py", line 1630, in parse_feeds
  File "site-packages/calibre/web/feeds/news.py", line 438, in get_feeds
NotImplementedError
failoversofa is offline   Reply With Quote
Old 01-20-2016, 02:10 AM   #8
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You need to also have

feeds = [...]

in your recipe
kovidgoyal is offline   Reply With Quote
Old 01-21-2016, 06:42 PM   #9
failoversofa
Junior Member
failoversofa began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jan 2016
Device: x-platform
Thanks, I appreciate your help and am making headway now.

failoversofa is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Recipe Request Tadpole Angel Recipes 0 07-22-2013 05:49 AM
recipe request polymath Recipes 0 05-22-2013 06:09 PM
Recipe Request rayh Recipes 1 04-09-2012 12:18 AM
recipe request chell1948 Recipes 1 06-02-2011 01:23 PM
Request for recipe girlperson1 Calibre 2 11-13-2008 10:03 PM


All times are GMT -4. The time now is 11:17 PM.


MobileRead.com is a privately owned, operated and funded community.