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 12-15-2012, 04:07 AM   #1
scissors
Addict
scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.
 
Posts: 200
Karma: 1001369
Join Date: Sep 2010
Device: prs300, kindle keyboard 3g
birmingham post update

Correct cover fetched

Spoiler:
Code:
from calibre.web.feeds.news import BasicNewsRecipe
from calibre import browser
import re
import mechanize
from calibre.utils.magick import Image

class AdvancedUserRecipe1306097511(BasicNewsRecipe):
    title          = u'Birmingham post'
    description = 'Author D.Asbury. News for Birmingham UK'
    #timefmt = ''
    __author__ = 'Dave Asbury'
    cover_url = 'http://profile.ak.fbcdn.net/hprofile-ak-snc4/161987_9010212100_2035706408_n.jpg'
    oldest_article = 2
    max_articles_per_feed = 12
    linearize_tables = True
    remove_empty_feeds = True
    remove_javascript     = True
    no_stylesheets = True
    auto_cleanup = True
    language = 'en_GB'

    cover_url = 'http://profile.ak.fbcdn.net/hprofile-ak-snc4/161987_9010212100_2035706408_n.jpg'

    masthead_url        = 'http://www.trinitymirror.com/images/birminghampost-logo.gif'
    def get_cover_url(self):
        soup = self.index_to_soup('http://www.birminghampost.net')
        # look for the block containing the sun button and url
        cov = soup.find(attrs={'height' : re.compile('3'), 'alt' : re.compile('Birmingham Post')})
        print
        print '%%%%%%%%%%%%%%%',cov
        print
        cov2 = str(cov['src'])
       # cov2=cov2[7:]
        print '88888888 ',cov2,' 888888888888'
        
        #cover_url=cov2
        #return cover_url
        br = mechanize.Browser()
        br.set_handle_redirect(False)
        try:
            br.open_novisit(cov2)
            cover_url = cov2
        except:
            cover_url = 'http://profile.ak.fbcdn.net/hprofile-ak-snc4/161987_9010212100_2035706408_n.jpg'
        return cover_url
    
    

    feeds          = [
        #(u'News',u'http://www.birminghampost.net/news/rss.xml'),
        (u'West Mids. News', u'http://www.birminghampost.net/news/west-midlands-news/rss.xml'),
        (u'UK News', u'http://www.birminghampost.net/news/uk-news/rss.xml'),
        (u'Sports',u'http://www.birminghampost.net/midlands-birmingham-sport/rss.xml'),
        (u'Bloggs & Comments',u'http://www.birminghampost.net/comment/rss.xml')

         ]

Last edited by scissors; 12-15-2012 at 04:39 AM.
scissors is offline   Reply With Quote
Old 02-02-2013, 07:40 AM   #2
scissors
Addict
scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.scissors ought to be getting tired of karma fortunes by now.
 
Posts: 200
Karma: 1001369
Join Date: Sep 2010
Device: prs300, kindle keyboard 3g
2/2/13

get cover adjusted

Spoiler:
Code:
from calibre.web.feeds.news import BasicNewsRecipe
from calibre import browser
import re
import mechanize
from calibre.utils.magick import Image

class AdvancedUserRecipe1306097511(BasicNewsRecipe):
    title          = u'Birmingham post'
    description = 'Author D.Asbury. News for Birmingham UK'
    #timefmt = ''
    __author__ = 'Dave Asbury'
    cover_url = 'http://profile.ak.fbcdn.net/hprofile-ak-snc4/161987_9010212100_2035706408_n.jpg'
    oldest_article = 2
    max_articles_per_feed = 12
    linearize_tables = True
    remove_empty_feeds = True
    remove_javascript     = True
    no_stylesheets = True
    auto_cleanup = True
    language = 'en_GB'

    cover_url = 'http://profile.ak.fbcdn.net/hprofile-ak-snc4/161987_9010212100_2035706408_n.jpg'

    masthead_url        = 'http://www.trinitymirror.com/images/birminghampost-logo.gif'
    def get_cover_url(self):
        soup = self.index_to_soup('http://www.birminghampost.net')
        # look for the block containing the sun button and url
        cov = soup.find(attrs={'height' : re.compile('3'), 'alt' : re.compile('Post')})
        print
        print '%%%%%%%%%%%%%%%',cov
        print
        cov2 = str(cov['src'])
       # cov2=cov2[7:]
        print '88888888 ',cov2,' 888888888888'
        
        #cover_url=cov2
        #return cover_url
        br = mechanize.Browser()
        br.set_handle_redirect(False)
        try:
            br.open_novisit(cov2)
            cover_url = cov2
        except:
            cover_url = 'http://profile.ak.fbcdn.net/hprofile-ak-snc4/161987_9010212100_2035706408_n.jpg'
        return cover_url
    
    

    feeds          = [
        #(u'News',u'http://www.birminghampost.net/news/rss.xml'),
        (u'West Mids. News', u'http://www.birminghampost.net/news/west-midlands-news/rss.xml'),
        (u'UK News', u'http://www.birminghampost.net/news/uk-news/rss.xml'),
        (u'Sports',u'http://www.birminghampost.net/midlands-birmingham-sport/rss.xml'),
        (u'Bloggs & Comments',u'http://www.birminghampost.net/comment/rss.xml')

         ]
scissors is offline   Reply With Quote
 
Enthusiast
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
birmingham post update scissors Recipes 0 09-08-2012 12:05 PM
Birmingham (UK) post updated 9/6/12 scissors Recipes 0 06-09-2012 10:24 AM
Recipe : Birmingham Post - uk scissors Recipes 0 12-22-2011 02:00 PM
Without Warning by John Birmingham GlenBarrington Reading Recommendations 6 09-03-2010 09:42 PM


All times are GMT -4. The time now is 10:09 AM.


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