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

Go Back   MobileRead Forums > E-Book Software > Calibre

Welcome to the MobileRead Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community today, you will have fewer ads, access to post topics, communicate privately with other members, respond to polls, upload content and access many other special features.

If you have any problems with the registration process or your account login, please contact us.

Hint: Don't have time to visit us daily? Subscribe to our main RSS feed to receive our frontpage posts at your convenience.

Notices

Calibre New! Calibre is an open-source library manager to view, convert and catalog e-books. Cross-platform (Linux, Windows and OS X)

Reply
 
Thread Tools Search this Thread Display Modes
Old 11-11-2008, 07:29 AM   #1
AprilHare
Addict
AprilHare has a complete set of Star Wars action figures.AprilHare has a complete set of Star Wars action figures.AprilHare has a complete set of Star Wars action figures.AprilHare has a complete set of Star Wars action figures.AprilHare has a complete set of Star Wars action figures.
 
AprilHare's Avatar
 
Posts: 274
Karma: 493
Join Date: Apr 2008
Device: Sony Reader PRS-500
Request: New Scientist recipe

Hello,
I'd very much like a working recipe for New Scientist magazine from the RSS feeds here. I tried applying the feeds directly in calibre for a simple recipe however I end up with LRF files with nothing in them. It's a major magazine and it'd make a great addition to the calibre recipe collection.
AprilHare is offline   Reply With Quote
Old 11-11-2008, 01:54 PM   #2
kiklop74
Addict
kiklop74 will become famous soon enoughkiklop74 will become famous soon enoughkiklop74 will become famous soon enoughkiklop74 will become famous soon enoughkiklop74 will become famous soon enoughkiklop74 will become famous soon enough
 
kiklop74's Avatar
 
Posts: 308
Karma: 516
Join Date: Dec 2007
Location: Argentina
Device: Palm Tx, Sony PRS-505
Here goes:

Code:
#!/usr/bin/env  python

__license__   = 'GPL v3'
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
'''
newscientist.com
'''

from calibre.web.feeds.news import BasicNewsRecipe

class Newscientist(BasicNewsRecipe):
    title                 = u'New Scientist - Online News'
    __author__            = 'Darko Miletic'
    description           = 'News from Science'
    oldest_article        = 7
    max_articles_per_feed = 100
    no_stylesheets        = True
    use_embedded_content  = False
    
    keep_only_tags = [
                        dict(name='div'  , attrs={'id':'pgtop'   })
                       ,dict(name='div'  , attrs={'id':'maincol' })
                     ]
    remove_tags = [
                     dict(name='div'  , attrs={'class':'hldBd' })
                    ,dict(name='div'  , attrs={'id':'compnl' })
                    ,dict(name='div'  , attrs={'id':'artIssueInfo' })
                  ]

    feeds          = [
                        (u'Latest Headlines' , u'http://feeds.newscientist.com/science-news'              )
                       ,(u'Magazine'         , u'http://www.newscientist.com/feed/magazine'               )                      
                       ,(u'Health'           , u'http://www.newscientist.com/feed/view?id=2&type=channel' )
                       ,(u'Life'             , u'http://www.newscientist.com/feed/view?id=3&type=channel' )
                       ,(u'Space'            , u'http://www.newscientist.com/feed/view?id=6&type=channel' )
                     ]
kiklop74 is offline   Reply With Quote
Old 11-11-2008, 05:58 PM   #3
AprilHare
Addict
AprilHare has a complete set of Star Wars action figures.AprilHare has a complete set of Star Wars action figures.AprilHare has a complete set of Star Wars action figures.AprilHare has a complete set of Star Wars action figures.AprilHare has a complete set of Star Wars action figures.
 
AprilHare's Avatar
 
Posts: 274
Karma: 493
Join Date: Apr 2008
Device: Sony Reader PRS-500
She works! (Is code male, female or neuter?) Thankyou!
AprilHare is offline   Reply With Quote
Old 11-11-2008, 06:12 PM   #4
kovidgoyal
Creator of calibre, Ph.D.
kovidgoyal can self-interpret dreams as they happen.kovidgoyal can self-interpret dreams as they happen.kovidgoyal can self-interpret dreams as they happen.kovidgoyal can self-interpret dreams as they happen.kovidgoyal can self-interpret dreams as they happen.kovidgoyal can self-interpret dreams as they happen.kovidgoyal can self-interpret dreams as they happen.kovidgoyal can self-interpret dreams as they happen.kovidgoyal can self-interpret dreams as they happen.kovidgoyal can self-interpret dreams as they happen.kovidgoyal can self-interpret dreams as they happen.
 
kovidgoyal's Avatar
 
Posts: 7,216
Karma: 20001
Join Date: Oct 2006
Location: Albuquerque, NM
Device: PRS-500/505/700, K2, BeBook
Definitely female considering the amount of time I spend staring at her
__________________
Get calibre
kovidgoyal is offline   Reply With Quote
Old 11-11-2008, 06:33 PM   #5
AprilHare
Addict
AprilHare has a complete set of Star Wars action figures.AprilHare has a complete set of Star Wars action figures.AprilHare has a complete set of Star Wars action figures.AprilHare has a complete set of Star Wars action figures.AprilHare has a complete set of Star Wars action figures.
 
AprilHare's Avatar
 
Posts: 274
Karma: 493
Join Date: Apr 2008
Device: Sony Reader PRS-500
Quote:
Originally Posted by kovidgoyal View Post
Definitely female considering the amount of time I spend staring at her
Your mistress may need attention: she prints "None" underneath every article link.
Sample attached.
Just don't mention this to your wife and everything will be OK

Last edited by AprilHare; 11-11-2008 at 06:33 PM. Reason: clarification
AprilHare is offline   Reply With Quote
Old 11-11-2008, 07:48 PM   #6
kiklop74
Addict
kiklop74 will become famous soon enoughkiklop74 will become famous soon enoughkiklop74 will become famous soon enoughkiklop74 will become famous soon enoughkiklop74 will become famous soon enoughkiklop74 will become famous soon enough
 
kiklop74's Avatar
 
Posts: 308
Karma: 516
Join Date: Dec 2007
Location: Argentina
Device: Palm Tx, Sony PRS-505
Quote:
Originally Posted by AprilHare View Post
Your mistress may need attention: she prints "None" underneath every article link.
Are you having problems with this script?
kiklop74 is offline   Reply With Quote
Old 11-11-2008, 09:01 PM   #7
kovidgoyal
Creator of calibre, Ph.D.
kovidgoyal can self-interpret dreams as they happen.kovidgoyal can self-interpret dreams as they happen.kovidgoyal can self-interpret dreams as they happen.kovidgoyal can self-interpret dreams as they happen.kovidgoyal can self-interpret dreams as they happen.kovidgoyal can self-interpret dreams as they happen.kovidgoyal can self-interpret dreams as they happen.kovidgoyal can self-interpret dreams as they happen.kovidgoyal can self-interpret dreams as they happen.kovidgoyal can self-interpret dreams as they happen.kovidgoyal can self-interpret dreams as they happen.
 
kovidgoyal's Avatar
 
Posts: 7,216
Karma: 20001
Join Date: Oct 2006
Location: Albuquerque, NM
Device: PRS-500/505/700, K2, BeBook
Quote:
Originally Posted by AprilHare View Post
Your mistress may need attention: she prints "None" underneath every article link.
Sample attached.
Just don't mention this to your wife and everything will be OK
She just needed a little massaging. Will be in next release. As for my wife, we have a totally open relationship when it comes to code
__________________
Get calibre
kovidgoyal is offline   Reply With Quote
Old 11-11-2008, 11:16 PM   #8
AprilHare
Addict
AprilHare has a complete set of Star Wars action figures.AprilHare has a complete set of Star Wars action figures.AprilHare has a complete set of Star Wars action figures.AprilHare has a complete set of Star Wars action figures.AprilHare has a complete set of Star Wars action figures.
 
AprilHare's Avatar
 
Posts: 274
Karma: 493
Join Date: Apr 2008
Device: Sony Reader PRS-500
Quote:
Originally Posted by kiklop74 View Post
Are you having problems with this script?
No the script seems to be working fine New Scientist Good!
I am thinking about modifying it to add more of the feeds (the topic guides would be too much). Will give it a go later on.
AprilHare is offline   Reply With Quote
Old 11-13-2008, 11:37 AM   #9
Derry
Member
Derry began at the beginning.
 
Posts: 13
Karma: 10
Join Date: Aug 2008
Device: Sony PRS505
Thanks so much for the feed, much appreciated
Derry is offline   Reply With Quote
Old 11-24-2008, 08:33 AM   #10
Ler0y Jenkins
Enthusiast
Ler0y Jenkins began at the beginning.
 
Posts: 42
Karma: 30
Join Date: Oct 2008
Device: Sony PRS-505
Can someone explain to me how to use this code? I'm new to the e-book world and have no idea what a "feed" is or any of the other stuff in this thread. Does this allow you to view New Scientist Magazine on your Sony E-Reader? Please help, I'm lost...

Edit: Never mind. I saw the "fetch news" tab at the top and New Scientist is listed as a perodical. I'm downloading it now and I assume I'll just have to upload it to my ereader and that should be it.

Last edited by Ler0y Jenkins; 11-24-2008 at 08:54 AM.
Ler0y Jenkins is offline   Reply With Quote
Old 11-24-2008, 09:17 AM   #11
AprilHare
Addict
AprilHare has a complete set of Star Wars action figures.AprilHare has a complete set of Star Wars action figures.AprilHare has a complete set of Star Wars action figures.AprilHare has a complete set of Star Wars action figures.AprilHare has a complete set of Star Wars action figures.
 
AprilHare's Avatar
 
Posts: 274
Karma: 493
Join Date: Apr 2008
Device: Sony Reader PRS-500
Quote:
Originally Posted by Ler0y Jenkins View Post
Can someone explain to me how to use this code? I'm new to the e-book world and have no idea what a "feed" is or any of the other stuff in this thread. Does this allow you to view New Scientist Magazine on your Sony E-Reader? Please help, I'm lost...

Edit: Never mind. I saw the "fetch news" tab at the top and New Scientist is listed as a perodical. I'm downloading it now and I assume I'll just have to upload it to my ereader and that should be it.
It doesn't let you read the magazine exactly: it lets you read the articles referenced in NewScientist.com RSS feeds (NewScientist.com corresponds to New Scientist magazines' online presence and shares content).
As Wikipedia puts it, "RSS is a family of Web feed formats used to publish frequently updated works—such as blog entries, news headlines, audio, and video—in a standardized format." In this case, featured New Scientist articles.

It is doubtful you would get full articles that NewScientist.com requires you to buy a subscription to view, however. They've got to give us encouragement to pay somehow!

Last edited by AprilHare; 11-24-2008 at 09:33 AM. Reason: Clarification
AprilHare is offline   Reply With Quote
Old 11-24-2008, 09:26 AM   #12
AprilHare
Addict
AprilHare has a complete set of Star Wars action figures.AprilHare has a complete set of Star Wars action figures.AprilHare has a complete set of Star Wars action figures.AprilHare has a complete set of Star Wars action figures.AprilHare has a complete set of Star Wars action figures.
 
AprilHare's Avatar
 
Posts: 274
Karma: 493
Join Date: Apr 2008
Device: Sony Reader PRS-500
Here is an improvement: a few more feeds added:
Code:
#!/usr/bin/env  python

__license__   = 'GPL v3'
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>, AprilHare'
'''
newscientist.com
'''

from calibre.web.feeds.news import BasicNewsRecipe

class Newscientist(BasicNewsRecipe):
    title                 = u'New Scientist - Online News'
    __author__            = 'Darko Miletic'
    description           = 'News from Science'
    oldest_article        = 7
    max_articles_per_feed = 100
    no_stylesheets        = True
    use_embedded_content  = False
    
    keep_only_tags = [
                        dict(name='div'  , attrs={'id':'pgtop'   })
                       ,dict(name='div'  , attrs={'id':'maincol' })
                     ]
    remove_tags = [
                     dict(name='div'  , attrs={'class':'hldBd' })
                    ,dict(name='div'  , attrs={'id':'compnl' })
                    ,dict(name='div'  , attrs={'id':'artIssueInfo' })
                  ]

    feeds          = [
                        (u'Latest Headlines' , u'http://feeds.newscientist.com/science-news'              )
                       ,(u'Magazine'         , u'http://www.newscientist.com/feed/magazine'               )                      
                       ,(u'Health'           , u'http://www.newscientist.com/feed/view?id=2&type=channel' )
                       ,(u'Life'             , u'http://www.newscientist.com/feed/view?id=3&type=channel' )
                       ,(u'Space'            , u'http://www.newscientist.com/feed/view?id=6&type=channel' )
                       ,(u'Physics and Mathematics'            , u'http://www.newscientist.com/feed/view?id=4&type=channel' )
                       ,(u'Environment'            , u'http://www.newscientist.com/feed/view?id=1&type=channel' )
                       ,(u'Science in Society'            , u'http://www.newscientist.com/feed/view?id=5&type=channel' )
                       ,(u'Tech'            , u'http://www.newscientist.com/feed/view?id=7&type=channel' )
                     ]
AprilHare is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
recipe editing alexxxm Calibre 1 10-31-2008 11:42 AM
Help with news recipe Acey Calibre 1 10-09-2008 02:36 PM
Newsweek Recipe SnafuRacer Calibre 5 07-07-2008 02:35 PM
Dual display navigation - New Scientist article ePossum News and Commentary 37 06-30-2008 04:42 AM
How to rewrite New Scientist links pingtiao Sunrise 3 02-05-2007 05:50 PM


All times are GMT -4. The time now is 08:18 PM.


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