Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 08-11-2008, 10:13 AM   #1
Derry
Member
Derry began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Aug 2008
Device: Sony PRS505
Problem with News scripts

Hi,
I've been using this great software since the day I got my PRS505, and firstly would like to say thanks for the software.

I've been having a problem with a script to fetch RSS feeds for a while now and was wondering if someone could point out where I'm going wrong.

Originally I was using the script generated by Calibre when you add the feeds:
Code:
class AdvancedUserRecipe1218463759(BasicNewsRecipe):
    title          = u'International Herald Tribune'
    oldest_article = 1
    max_articles_per_feed = 15
    
    feeds          = [(u'Frontpage', u'http://www.iht.com/rss/frontpage.xml'), (u'Business', u'http://www.iht.com/rss/business.xml'), (u'Americas', u'http://www.iht.com/rss/america.xml'), (u'Europe', u'http://www.iht.com/rss/europe.xml'), (u'Asia', u'http://www.iht.com/rss/asia.xml'), (u'Africa and Middle East', u'http://www.iht.com/rss/africa.xml'), (u'Opinion', u'http://www.iht.com/rss/opinion.xml'), (u'Technology', u'http://www.iht.com/rss/technology.xml'), (u'Health and Science', u'http://www.iht.com/rss/healthscience.xml'), (u'Sports', u'http://www.iht.com/rss/sports.xml'), (u'Culture', u'http://www.iht.com/rss/arts.xml'), (u'Style and Design', u'http://www.iht.com/rss/style.xml'), (u'Travel', u'http://www.iht.com/rss/travel.xml'), (u'At Home Abroad', u'http://www.iht.com/rss/athome.xml'), (u'Your Money', u'http://www.iht.com/rss/yourmoney.xml'), (u'Properties', u'http://www.iht.com/rss/properties.xml')]
The problem is that while it pulls down the feeds fine, the fonts in the table of contents are too large, and there are a lot of things that could be cleaned up, so I tried writing a custom script, but every attempt to modify the script causes a problem where it includes photos ads etc and the the script then takes over a half an hour to run as opposed to a few minutes.

Here is the current version of my custom script:
Code:
class InternationalHeraldTribune(BasicNewsRecipe):
    title          = u'The International Herald Tribune'
    __author__     = 'Derry FitzGerald'
    oldest_article = 1
    max_articles_per_feed = 15
    no_stylesheets = True

    remove_tags    = [dict(name='div', attrs={'class':'footer'})]
    extra_css      = '.headline {font-size: x-large;} \n .fact { padding-top: 10pt  }' 

    feeds          = [
                      (u'Frontpage', u'http://www.iht.com/rss/frontpage.xml'), 
                      (u'Business', u'http://www.iht.com/rss/business.xml'),
                      (u'Americas', u'http://www.iht.com/rss/america.xml'),
                      (u'Europe', u'http://www.iht.com/rss/europe.xml'),
                      (u'Asia', u'http://www.iht.com/rss/asia.xml'),
                      (u'Africa and Middle East', u'http://www.iht.com/rss/africa.xml'),
                      (u'Opinion', u'http://www.iht.com/rss/opinion.xml'),
                      (u'Technology', u'http://www.iht.com/rss/technology.xml'),
                      (u'Health and Science', u'http://www.iht.com/rss/healthscience.xml'),
                      (u'Sports', u'http://www.iht.com/rss/sports.xml'),
                      (u'Culture', u'http://www.iht.com/rss/arts.xml'),
                      (u'Style and Design', u'http://www.iht.com/rss/style.xml'),
                      (u'Travel', u'http://www.iht.com/rss/travel.xml'),
                      (u'At Home Abroad', u'http://www.iht.com/rss/athome.xml'),
                      (u'Your Money', u'http://www.iht.com/rss/yourmoney.xml'),
                      (u'Properties', u'http://www.iht.com/rss/properties.xml')
                    ]

Hopefully it is something simple that I'm missing.

Also here is a simple script for the Irish Times which works pretty well and might be of use to someone,
Code:
#!/usr/bin/env  python

__license__   = 'GPL v3'
__copyright__ = '2008, Derry FitzGerald'
'''
irishtimes.com
'''

from calibre.web.feeds.news import BasicNewsRecipe

class IrishTimes(BasicNewsRecipe):
    title          = u'The Irish Times'
    __author__     = 'Derry FitzGerald'
    no_stylesheets = True

    remove_tags    = [dict(name='div', attrs={'class':'footer'})]
    extra_css      = '.headline {font-size: x-large;} \n .fact { padding-top: 10pt  }' 

    feeds          = [
                      ('Frontpage', 'http://www.irishtimes.com/feeds/rss/newspaper/index.rss'), 
                      ('Ireland', 'http://www.irishtimes.com/feeds/rss/newspaper/ireland.rss'),
                      ('World', 'http://www.irishtimes.com/feeds/rss/newspaper/world.rss'),
                      ('Finance', 'http://www.irishtimes.com/feeds/rss/newspaper/finance.rss'),
                      ('Features', 'http://www.irishtimes.com/feeds/rss/newspaper/features.rss'),
                      ('Sport', 'http://www.irishtimes.com/feeds/rss/newspaper/sport.rss'),
                      ('Opinion', 'http://www.irishtimes.com/feeds/rss/newspaper/opinion.rss'),
                      ('Letters', 'http://www.irishtimes.com/feeds/rss/newspaper/letters.rss'),
                      ('Health', 'http://www.irishtimes.com/feeds/rss/newspaper/health.rss'),
                      ('Education and Parenting', 'http://www.irishtimes.com/feeds/rss/newspaper/education.rss'),
                      ('Science Today', 'http://www.irishtimes.com/feeds/rss/newspaper/sciencetoday.rss'),
                      ('The Ticket', 'http://www.irishtimes.com/feeds/rss/newspaper/theticket.rss'),
                      ('Weekend', 'http://www.irishtimes.com/feeds/rss/newspaper/weekend.rss'),
                      ('News Features', 'http://www.irishtimes.com/feeds/rss/newspaper/newsfeatures.rss'),
                      ('Magazine', 'http://www.irishtimes.com/feeds/rss/newspaper/magazine.rss'),
                    ]

    def print_version(self, url):
        return url.replace('.html', '_pf.html')



Thanks in advance for any assistance
Derry
Derry is offline   Reply With Quote
Old 08-11-2008, 11:50 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: 25,913
Karma: 5035037
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Hmm dont see anything obviously wrong, open a ticket so I can keep track of it. I'm a little busy at the moment.
kovidgoyal is offline   Reply With Quote
 
Enthusiast
Old 08-12-2008, 05:01 AM   #3
Derry
Member
Derry began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Aug 2008
Device: Sony PRS505
Hi, thanks for getting back to me, I'll open a ticket now,
there is no problem if you don't get a chance to look at it.
Again thanks for the wonderful software
Derry
Derry is offline   Reply With Quote
Old 08-16-2008, 07:45 PM   #4
higgs
Member
higgs has a complete set of Star Wars action figures.higgs has a complete set of Star Wars action figures.higgs has a complete set of Star Wars action figures.
 
higgs's Avatar
 
Posts: 12
Karma: 252
Join Date: Aug 2008
Location: Inishowen, Ireland
Device: Sony PRS-505
Hi Derry,
Thanks for the recipe for the Irish News, I don't suppose you have a recipe for the Derry Journal?
higgs is offline   Reply With Quote
Old 08-19-2008, 05:08 AM   #5
Derry
Member
Derry began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Aug 2008
Device: Sony PRS505
Unfortunately no, I'm a native of Cork, only visited Derry once ever, had a great time!
Glad you liked the recipe,
Derry
Derry is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Catholic News Recipe Problem funkgut Calibre 4 04-23-2010 02:08 PM
Problem running scripts from ContentLister Fellball iRex 1 03-13-2009 08:16 PM
Fetch News problem in 5 tmcclell Calibre 3 03-11-2009 01:06 AM
Problem with News Feeds Sydney's Mom Calibre 10 03-07-2009 02:54 PM
Fetch News Problem in Calibre 0.4.55 sriram Calibre 4 05-21-2008 05:48 PM


All times are GMT -4. The time now is 05:44 PM.


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