Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 12-12-2010, 07:22 PM   #1
BuzzKill
Junior Member
BuzzKill began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Oct 2010
Device: Kindle
skepticblog.org - Recipe not working

http://skepticblog.org

Ok, I tried to get this one to work, but it doesn't seem to work. Somewhere in the details during processing a HTTP 403 error seems to pop up, but I will appreciate if someone can check it.

Code:
#!/usr/bin/env  python

import re
from calibre.web.feeds.news import BasicNewsRecipe
from calibre.ebooks.BeautifulSoup import Tag

class SkepticBlog(BasicNewsRecipe):
    title                 = 'Skepticblog'
    __author__            = 'Multiple Authors'
    description           = 'A collaboration among some of the most recognized names in promoting science, critical thinking, and skepticism'
    oldest_article        = 5
    max_articles_per_feed = 15
    no_stylesheets        = True
    use_embedded_content  = False
    encoding              = 'utf-8'
    publisher             = 'Skeptic Magazine'
    category              = 'science, pseudoscience'
    language              = 'en'

    lang                  = 'en-US'

    conversion_options = {
                          'comment'          : description
                        , 'tags'             : category
                        , 'publisher'        : publisher
                        , 'language'         : lang
                        , 'pretty_print'     : True
                        }

    keep_only_tags = [dict(name='div', attrs={'class':'post'})]
    remove_tags_after  = [dict(name='div', attrs={'class':'ratingblock'})]

    feeds = [(u'SkepticBlog', u'http://skepticblog.org/feed')]

    def preprocess_html(self, soup):
        mtag = Tag(soup,'meta',[('http-equiv','Content-Type'),('context','text/html; charset=utf-8')])
        soup.head.insert(0,mtag)
        soup.html['lang'] = self.lang
        return self.adeify_images(soup)

Last edited by BuzzKill; 12-14-2010 at 09:35 AM.
BuzzKill is offline   Reply With Quote
Old 12-14-2010, 02:01 PM   #2
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by BuzzKill View Post
http://skepticblog.org

Ok, I tried to get this one to work, but it doesn't seem to work. Somewhere in the details during processing a HTTP 403 error seems to pop up, but I will appreciate if someone can check it.
That site is running the Bad Behavior module to prevent spam from being posted to the blog. It triggers when Calibre tries to read it. The header code I wrote for The Skeptic recipe will fix it:

Code:
    def get_browser(self):
        br = BasicNewsRecipe.get_browser(self)
        br.addheaders = [('Accept', 'text/html')]
        return br
BTW, why aren't you using that recipe? It's built in and includes the http://skepticblog.org/feed feed.

Last edited by Starson17; 12-14-2010 at 02:13 PM.
Starson17 is offline   Reply With Quote
Advert
Old 12-14-2010, 03:35 PM   #3
BuzzKill
Junior Member
BuzzKill began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Oct 2010
Device: Kindle
Oh, I apologize, It didn't occur to me that there would be one already built in. Thank you.
BuzzKill is offline   Reply With Quote
Old 12-14-2010, 03:44 PM   #4
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by BuzzKill View Post
Oh, I apologize, It didn't occur to me that there would be one already built in. Thank you.
That's OK. I had to check myself to make sure it was included. It's hard to remember which feeds are in which recipes.
Starson17 is offline   Reply With Quote
Old 07-01-2016, 12:20 PM   #5
steven.davis
Junior Member
steven.davis began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Jul 2016
Device: kindle fire hdx
Not sure if anyone is still tracking this but I updated the feeds and it seems to be working.
Code:
from calibre.web.feeds.news import BasicNewsRecipe
import re

class Skeptic(BasicNewsRecipe):
    title          = u'The Skeptic'
    description         = 'Discussions with leading experts and investigation of fringe science and paranormal claims.'
    language       = 'en'
    __author__     = 'Starson17'
    oldest_article = 31
    cover_url           = 'http://www.skeptricks.com/images/Skeptic_Magazine.jpg'
    remove_empty_feeds    = True
    remove_javascript   = True
    max_articles_per_feed = 50
    no_stylesheets = True

    remove_tags = [dict(name='div', attrs={'class':['Introduction','divider']}),
                  dict(name='div', attrs={'id':['feature', 'podcast']}),
                  dict(name='div', attrs={'id':re.compile(r'follow.*', re.DOTALL|re.IGNORECASE)}),
                  dict(name='hr'),
                  ]


    feeds = [
            ('The Skeptic', 'http://feeds.feedburner.com/Skepticcom'),
            ('E-Skeptic', 'http://www.skeptic.com/eskeptic')
            ]

    def get_browser(self):
        br = BasicNewsRecipe.get_browser(self)
        br.addheaders = [('Accept', 'text/html')]
        return br

    extra_css = '''
                    h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
                    h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;}
                    p{font-family:Arial,Helvetica,sans-serif;font-size:small;}
                    body{font-family:Helvetica,Arial,sans-serif;font-size:small;}
		'''
steven.davis is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Guardian Recipe has stopped working jbambridge Calibre 2 04-11-2010 01:14 PM
The Economist (free) recipe not working paladin10000 Calibre 1 01-28-2010 12:44 PM
New Yorker recipe not working ... cartesio Calibre 11 08-20-2009 01:24 AM
Recipe not working phkoech Calibre 3 08-13-2009 05:41 PM
Recipe Suggestion: OnSuper8.Org KindleKid Calibre 0 07-28-2009 12:31 PM


All times are GMT -4. The time now is 07:51 PM.


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