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

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

Notices

Reply
 
Thread Tools Search this Thread
Old 01-22-2015, 06:27 PM   #1
ebrandon
Junior Member
ebrandon began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jan 2015
Device: Kindle Voyage
Recipe for TheAtlantic.com

Here's a recipe for TheAtlantic.com, an excellent publisher & aggregator of news and editorial about politics, culture, entertainment, tech, etc.

Note that there is a lot more content on TheAtlantic.com than is published in The Atlantic Magazine, and the website is updated constantly unlike the monthly magazine.

Although some articles from The Atlantic Magazine do appear on TheAtlantic.com, the magazine requires a subscription while the content on TheAtlantic.com is free.
Code:
#!/usr/bin/env python
# vim:fileencoding=utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
from calibre.web.feeds.news import BasicNewsRecipe

class AdvancedUserRecipe1421956712(BasicNewsRecipe):
    title          = 'TheAtlantic.com'
    oldest_article = 7
    max_articles_per_feed = 100
    auto_cleanup   = True
    ignore_duplicate_articles = {'title', 'url'} 
    
    def print_version(self, url):
        return url.replace('/archive/', '/print/')

    feeds          = [
        ('Politics', 'http://feeds.feedburner.com/AtlanticPoliticsChannel'),
        ('International', 'http://feeds.feedburner.com/AtlanticInternational'),
        ('National', 'http://feeds.feedburner.com/AtlanticNational'),
        ('Science and Tech', 'http://feeds.feedburner.com/AtlanticScienceAndTechnology'),
        ('Business', 'http://feeds.feedburner.com/AtlanticBusinessChannel'),
        ('Health', 'http://feeds.feedburner.com/AtlanticFood'),
        ('Education', 'http://feeds.feedburner.com/AtlanticEducationChannel'),
        ('Entertainment', 'http://feeds.feedburner.com/AtlanticCulture'),
        ('Sexes', 'http://feeds.feedburner.com/AtlanticSexesChannel'),
        ('The Atlantic', 'http://feeds.feedburner.com/TheAtlantic'),
        ('The Atlatic Wire', 'http://feeds.feedburner.com/TheAtlanticWire'),
    ]

Last edited by kovidgoyal; 01-22-2015 at 10:28 PM.
ebrandon is offline   Reply With Quote
Old 01-22-2015, 06:30 PM   #2
ebrandon
Junior Member
ebrandon began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jan 2015
Device: Kindle Voyage
I don't know how to preserve indentation in recipes I post here. If anyone knows the trick please reply and I'll edit the recipe to reflect the correct indentation.
ebrandon is offline   Reply With Quote
Old 01-22-2015, 06:39 PM   #3
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 8,188
Karma: 51095987
Join Date: Nov 2007
Location: Toronto
Device: Wife: Touch, Arc, Vox Me: Nexus 7, Glo
The trick is simple....

Just wrap the script in a [code] ... [/code] block.

Code:
#!/usr/bin/env python
# vim:fileencoding=utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
from calibre.web.feeds.news import BasicNewsRecipe

class AdvancedUserRecipe1421956712(BasicNewsRecipe):
    title          = 'TheAtlantic.com'
    oldest_article = 7
    max_articles_per_feed = 100
    auto_cleanup   = True
    ignore_duplicate_articles = {'title', 'url'} 
    
    def print_version(self, url):
        return url.replace('/archive/', '/print/')

    feeds          = [
        ('Politics', 'http://feeds.feedburner.com/AtlanticPoliticsChannel'),
        ('International', 'http://feeds.feedburner.com/AtlanticInternational'),
        ('National', 'http://feeds.feedburner.com/AtlanticNational'),
        ('Science and Tech', 'http://feeds.feedburner.com/AtlanticScienceAndTechnology'),
        ('Business', 'http://feeds.feedburner.com/AtlanticBusinessChannel'),
        ('Health', 'http://feeds.feedburner.com/AtlanticFood'),
        ('Education', 'http://feeds.feedburner.com/AtlanticEducationChannel'),
        ('Entertainment', 'http://feeds.feedburner.com/AtlanticCulture'),
        ('Sexes', 'http://feeds.feedburner.com/AtlanticSexesChannel'),
        ('The Atlantic', 'http://feeds.feedburner.com/TheAtlantic'),
        ('The Atlatic Wire', 'http://feeds.feedburner.com/TheAtlanticWire'),
    ]
PeterT is online now   Reply With Quote
Old 01-22-2015, 06:53 PM   #4
ebrandon
Junior Member
ebrandon began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jan 2015
Device: Kindle Voyage
Thanks for the info, Peter. I'll use it going forward as I work on new recipes.
ebrandon 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
Recipe works when mocked up as Python file, fails when converted to Recipe ode Recipes 7 09-04-2011 04:57 AM
New Recipe UtahJames Recipes 3 04-18-2011 08:02 PM
Need Help with Recipe UtahJames Recipes 1 04-12-2011 09:50 AM
New Recipe UtahJames Recipes 1 04-11-2011 04:15 PM
Question on TheAtlantic News Recipe gilamon Calibre 6 11-05-2008 03:07 PM


All times are GMT -4. The time now is 03:30 PM.


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