11-11-2008, 07:29 AM | #1 |
Wizard
Posts: 2,981
Karma: 11862367
Join Date: Apr 2008
Device: Sony Reader PRS-T2
|
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. |
11-11-2008, 01:54 PM | #2 |
Guru
Posts: 800
Karma: 194644
Join Date: Dec 2007
Location: Argentina
Device: Kindle Voyage
|
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' ) ] |
Advert | |
|
11-11-2008, 05:58 PM | #3 |
Wizard
Posts: 2,981
Karma: 11862367
Join Date: Apr 2008
Device: Sony Reader PRS-T2
|
She works! (Is code male, female or neuter?) Thankyou!
|
11-11-2008, 06:12 PM | #4 |
creator of calibre
Posts: 43,871
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Definitely female considering the amount of time I spend staring at her
|
11-11-2008, 06:33 PM | #5 | |
Wizard
Posts: 2,981
Karma: 11862367
Join Date: Apr 2008
Device: Sony Reader PRS-T2
|
Quote:
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 |
|
Advert | |
|
11-11-2008, 07:48 PM | #6 |
Guru
Posts: 800
Karma: 194644
Join Date: Dec 2007
Location: Argentina
Device: Kindle Voyage
|
|
11-11-2008, 09:01 PM | #7 |
creator of calibre
Posts: 43,871
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
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
|
11-11-2008, 11:16 PM | #8 |
Wizard
Posts: 2,981
Karma: 11862367
Join Date: Apr 2008
Device: Sony Reader PRS-T2
|
|
11-13-2008, 11:37 AM | #9 |
Member
Posts: 13
Karma: 10
Join Date: Aug 2008
Device: Sony PRS505
|
Thanks so much for the feed, much appreciated
|
11-24-2008, 08:33 AM | #10 |
Connoisseur
Posts: 61
Karma: 162
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. |
11-24-2008, 09:17 AM | #11 | |
Wizard
Posts: 2,981
Karma: 11862367
Join Date: Apr 2008
Device: Sony Reader PRS-T2
|
Quote:
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 |
|
11-24-2008, 09:26 AM | #12 |
Wizard
Posts: 2,981
Karma: 11862367
Join Date: Apr 2008
Device: Sony Reader PRS-T2
|
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' ) ] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Recipe request please | aessedai44 | Recipes | 2 | 10-06-2010 01:07 AM |
Yet another Recipe request.. | sherman | Calibre | 4 | 11-21-2008 04:42 AM |
Request for Recipe | girlperson1 | Calibre | 2 | 11-14-2008 10:43 PM |
Request for Recipe | girlperson1 | Calibre | 2 | 11-14-2008 07:59 AM |
Request for recipe | girlperson1 | Calibre | 2 | 11-13-2008 10:03 PM |