View Single Post
Old 06-23-2010, 08:41 PM   #2190
nook.life
Member
nook.life began at the beginning.
 
Posts: 12
Karma: 10
Join Date: May 2010
Device: Nook
Quote:
Originally Posted by Starson17 View Post
Try this:
Code:
from calibre.web.feeds.news import BasicNewsRecipe
from calibre.ebooks.BeautifulSoup import BeautifulSoup

class Explosm(BasicNewsRecipe):
    title               = 'Explosm'
    __author__          = 'Starson17'
    description         = 'Explosm'
    language            = 'en'
    use_embedded_content= False
    no_stylesheets      = True
    linearize_tables      = True
    oldest_article      = 24
    remove_javascript   = True
    remove_empty_feeds    = True
    max_articles_per_feed = 10

    feeds = [
             (u'Explosm Feed', u'http://feeds.feedburner.com/Explosm')
             ]

    def get_article_url(self, article):
        return article.get('link', None)

    keep_only_tags     = [dict(name='div', attrs={'id':'maincontent'})]

    def preprocess_html(self, soup):
        table_tags = soup.findAll('table')
        table_tags[1].extract() 
        NavTag = soup.find(text='« First') 
        NavTag.parent.parent.extract()
        return soup

    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;}
		'''
Quote:
Originally Posted by Starson17 View Post
I took a look at it. I told you I took a look at it. I asked you a question. You didn't respond, so I stopped. I like to know there's really someone out there.
Wow don't I feel stupid. I searched the replies for a response before posting the message, but somehow missed it. Even now I had to do a google search on the forum to find it. Thank you so, so much for looking into this recipe and taking the time to help me out. I really appreciate it. In answer to your question, yes i looked through those first, but it was not offered.

I tried the recipe out and it almost works. Unfortunately, the cartoon gets cut in half. Please see attached pic. Perhaps blending in rford's code above for rotating cartoons would work. I replaced his code with yours starting at def postprocess_html, but the recipe did not work at all (clearly it could not have been that easy, although I figured i'd try)

Thanks again for your help and sorry once again for not fully searching the forum before asking for the request again. THANK YOUUUUU

http://picturepush.com/public/3679162

Last edited by nook.life; 06-24-2010 at 01:21 PM.
nook.life is offline