04-25-2009, 05:51 PM | #46 |
Fervent Pleasure Seeker
Posts: 1,220
Karma: 712073
Join Date: Feb 2009
Location: The Windmills of My Mind
Device: Clara HD
|
Need help revising recipe please
I'm trying to revise the Fibro recipe to get news on another specific topic but it's kicking back the changes. I think I know what the problem is, but that's the name of the feed unless the issue is elsewhere. It won't even let me save it as a recipe. May I get some help please.
Here is the recipe #!/usr/bin/env python __license__ = 'GPL v3' __copyright__ = '2009, Darko Miletic <xxxxxxxxxxxxx>' ''' sciencedaily.com ''' from calibre.web.feeds.news import BasicNewsRecipe class ScienceDailySpec(BasicNewsRecipe): title = 'ScienceDaily - Alzheimer's' __author__ = 'Darko Miletic' description = "Breaking science news and articles on global warming, extrasolar planets, stem cells, bird flu, autism, nanotechnology, dinosaurs, evolution -- the latest discoveries in astronomy, anthropology, biology, chemistry, climate & environment, computers, engineering, health & medicine, math, physics, psychology, technology, and more -- from the world's leading universities and research organizations." oldest_article = 10000 language = _('English') max_articles_per_feed = 1000 no_stylesheets = True use_embedded_content = False keep_only_tags = [ dict(name='h1', attrs={'class':'story'}) ,dict(name='div', attrs={'id':'story'}) ] remove_tags_after = dict(name='div', attrs={'id':'citationbox'}) remove_tags = [ dict(name='div', attrs={'id':'seealso'}) ,dict(name='div', attrs={'id':'citationbox'}) ] feeds = [(u"Alzheimer's Research News", u'http://www.sciencedaily.com/rss/health_medicine/alzheimer's.xml')] The only thing I changed was the title and the feed info. I think the apostrophe in the feed line is creating the issue but don't know enough to be sure. Problem comes in because that is the name of the feed. Also, please note, in the recipe the part including and after the apostrophe on the feed line is black as opposed to ochre/yellow. Screenshot included. Thanks. Forgot to mention, I need to add one more feed to the feeds and don't know how to do that. A quick explanation would help. Last edited by pghaworth; 04-25-2009 at 05:57 PM. |
04-25-2009, 07:11 PM | #47 |
Guru
Posts: 800
Karma: 194644
Join Date: Dec 2007
Location: Argentina
Device: Kindle Voyage
|
Your feed url has ' and that breaks the string. Enclose the feed url with double quotes like this:
Code:
feeds = [(u"Alzheimer's Research News", u"yourfeedurl")] Code:
feeds = [ (u"Alzheimer's Research News", u"yourfeedurl") ,(u"bbb", u"yourfeedurl") ,(u"ccc", u"yourfeedurl") ] |
Advert | |
|
04-25-2009, 08:47 PM | #48 |
Fervent Pleasure Seeker
Posts: 1,220
Karma: 712073
Join Date: Feb 2009
Location: The Windmills of My Mind
Device: Clara HD
|
Thanks! I'll give it a try.
|
04-25-2009, 09:10 PM | #49 |
Fervent Pleasure Seeker
Posts: 1,220
Karma: 712073
Join Date: Feb 2009
Location: The Windmills of My Mind
Device: Clara HD
|
Here's what I get now and here's my recipe modified.
Could not create recipe. Error: invalid syntax (recipe 20 py, line 15). This changes everytime I make a change but the line number stays the same. ````` #!/usr/bin/env python __license__ = 'GPL v3' __copyright__ = '2009, Darko Miletic <xxxxxxxxxxxxxxx>' ''' sciencedaily.com ''' from calibre.web.feeds.news import BasicNewsRecipe class ScienceDailySpec(BasicNewsRecipe): title = 'ScienceDaily - Alzheimer's' __author__ = 'Darko Miletic' description = "Breaking science news and articles on global warming, extrasolar planets, stem cells, bird flu, autism, nanotechnology, dinosaurs, evolution -- the latest discoveries in astronomy, anthropology, biology, chemistry, climate & environment, computers, engineering, health & medicine, math, physics, psychology, technology, and more -- from the world's leading universities and research organizations." oldest_article = 10000 language = _('English') max_articles_per_feed = 1000 no_stylesheets = True use_embedded_content = False keep_only_tags = [ dict(name='h1', attrs={'class':'story'}) ,dict(name='div', attrs={'id':'story'}) ] remove_tags_after = dict(name='div', attrs={'id':'citationbox'}) remove_tags = [ dict(name='div', attrs={'id':'seealso'}) ,dict(name='div', attrs={'id':'citationbox'}) ] feeds = [ (u"Alzheimer's Research News", u"http://www.sciencedaily.com/rss/health_medicine/alzheimer's.xml"), (u"Alzheimer's Research News", u"http://www.sciencedaily.com/rss/mind_brain/alzheimer's.xml") ] ~~~~~~~~~~ I know nothing about this type of programming so I am accomplishing the separation above using carriage returns - which I'm sure is wrong. Tried using a "tab" but that didn't work either. I'm feeling really dumb right now since I took visual basic programming a while back and should be better at this even tho' it's different. Sorry, and thanks for your help. |
04-28-2009, 11:52 AM | #50 |
Junior Member
Posts: 5
Karma: 10
Join Date: Apr 2009
Device: Sony PRS-505
|
Anyone have a recipe for U. S. News & World Report?
Does anyone have a recipe for U. S. News & World Report? If so, I would appreciate your sharing. If not, I'll try to work on it as time permits.
|
Advert | |
|
11-07-2009, 04:54 PM | #51 |
Junior Member
Posts: 2
Karma: 10
Join Date: Nov 2009
Device: Sony PRS-600
|
script login
I'm having trouble getting a script to login.
Here's the code: br.open('https://ssl.thenation.com/user/login.mhtml') br.select_form('tn-login') The site html reads: <form id="tn-login" action="https://ssl.thenation.com/user/login.mhtml" method="post"> The error output is below. Is there any way this can be fixed either in the script or, if this type of request isn't supported, in the API? ERROR: Conversion Error: <b>Failed</b>: Fetch news from The Nation - print edition Fetch news from The Nation - print edition InputFormatPlugin: Recipe Input running Python function terminated unexpectedly no form matching name 'tn-login' (Error Code: 1) Traceback (most recent call last): File "site.py", line 103, in main File "site.py", line 85, in run_entry_point File "site-packages\calibre\utils\ipc\worker.py", line 90, in main File "site-packages\calibre\gui2\convert\gui_conversion.py", line 19, in gui_convert File "site-packages\calibre\ebooks\conversion\plumber.py", line 721, in run File "site-packages\calibre\customize\conversion.py", line 208, in __call__ File "site-packages\calibre\web\feeds\input.py", line 60, in convert File "site-packages\calibre\web\feeds\news.py", line 509, in __init__ File "c:\docume~1\greg\locals~1\temp\calibre_0.6.20_5kl 0xo_recipes\recipe0.py", line 54, in get_browser br.select_form('tn-login') File "site-packages\mechanize-0.1.11-py2.6.egg\mechanize\_mechanize.py", line 530, in select_form mechanize._mechanize.FormNotFoundError: no form matching name 'tn-login' |
11-08-2009, 02:00 PM | #52 |
Guru
Posts: 800
Karma: 194644
Join Date: Dec 2007
Location: Argentina
Device: Kindle Voyage
|
select_form method only works if form has attribute name. In your case form has id which is not handled by select_form. You should use the number of ocurrence of this form within html page. It would be like this:
Code:
br.select_form(id=1) |
12-08-2009, 10:48 PM | #53 |
Junior Member
Posts: 2
Karma: 10
Join Date: Dec 2009
Device: Kindle 2
|
Is there a way to have Calibre not add the date to the title metadata for fetched news? I am using default recipes. When I transfer them to the Kindle it will automatically archive the older issue as long as they have the same name. But since Calibre is adding a date to the metadata it has a different name each day.
I can go in and edit each one after they are downloaded, but I was hoping there was a way to automate the process. Thanks for any help you can provide. |
12-08-2009, 10:50 PM | #54 |
creator of calibre
Posts: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Make a custom recipe based on the builtin one and set
timefmt = '' |
12-08-2009, 11:13 PM | #55 | |
Junior Member
Posts: 2
Karma: 10
Join Date: Dec 2009
Device: Kindle 2
|
Quote:
I also wanted to mention that your software was the deciding factor in me getting a Kindle. Outstanding program! |
|
01-10-2011, 08:07 PM | #56 |
Junior Member
Posts: 3
Karma: 10
Join Date: Jul 2010
Device: Nook
|
Strategy+Business Recipe
The Strategy+Business.com recipe is not working. It's clear that registration is required and the username and password need to be supplied. However, for some reason it's not working.
Also, can somebody suggest where exactly to hard code the username and password in the recipe? Thanks so much! |
03-24-2011, 07:18 AM | #57 |
Enthusiast
Posts: 43
Karma: 50
Join Date: May 2009
Device: Kindle3
|
I'm using the free Wall Street Journal recipe and the paper gets sent to my Kindle fine. However, it comes with the date as part of the title, so it doesn't archive issues like my other papers, it just keeps adding new titles (with the new dates) to my main menu. On recipes I've created myself, I put in the line timefmt = '', which seems to just leave the paper's title without a date, and they archive fine each day, saving the last 7 copies. How do I change a copy of the Wall Street Journal recipe to do the same thing? That recipe has the same line, but to no apparent effect.
|
03-24-2011, 10:47 AM | #58 |
creator of calibre
Posts: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Comment out the line that sets timefmt in the parse_index function
|
03-24-2011, 01:53 PM | #59 |
Enthusiast
Posts: 43
Karma: 50
Join Date: May 2009
Device: Kindle3
|
Thank you.
Kovid - thank you! Your help and work on this program is much appreciated.
|
11-26-2011, 12:04 PM | #60 |
Zealot
Posts: 109
Karma: 556
Join Date: Nov 2009
Location: SaiGon VietNam
Device: PRS T1, Kobo Forma 8G, Kobo Libra H2O
|
I want to create an recipe that can get most recent wikipedia featured articles. But there is not an RSS link for this. Any suggestion?
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help with calibre recipes | CaptainJSK | Calibre | 1 | 07-11-2010 01:12 AM |
Calibre Recipes and iPad/iBooks | jbambridge | Calibre | 8 | 05-16-2010 04:30 PM |
Classification of Recipes in Calibre | wayner | Calibre | 3 | 11-27-2009 09:48 AM |
Problem with my recipes (Calibre 0.6.2) | MikeBoud | Calibre | 18 | 08-05-2009 10:20 PM |