~stub/ubuntu/precise/calibre/devel

« back to all changes in this revision

Viewing changes to resources/recipes/sltrib.py

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-04-12 11:29:25 UTC
  • mfrom: (42.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20110412112925-c7171kt2bb5rmft4
Tags: 0.7.50+dfsg-2
* debian/control: Build with libpodofo-dev to enable PDF metadata.
  (Closes: #619632)
* debian/control: Add libboost1.42-dev build dependency. Apparently it is
  needed in some setups. (Closes: #619807)
* debian/rules: Call dh_sip to generate a proper sip API dependency, to
  prevent crashes like #616372 for partial upgrades.
* debian/control: Bump python-qt4 dependency to >= 4.8.3-2, which reportedly
  fixes crashes on startup. (Closes: #619701, #620125)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from calibre.web.feeds.news import BasicNewsRecipe
 
2
 
 
3
class AdvancedUserRecipe1278347258(BasicNewsRecipe):
 
4
    title      = u'Salt Lake City Tribune'
 
5
    __author__ = 'Charles Holbert'
 
6
    oldest_article = 7
 
7
    max_articles_per_feed = 100
 
8
 
 
9
    description            = '''Utah's independent news source since 1871'''
 
10
    publisher              = 'http://www.sltrib.com/'
 
11
    category               = 'news, Utah, SLC'
 
12
    language               = 'en'
 
13
    encoding               = 'utf-8'
 
14
    #delay                  = 1
 
15
    #simultaneous_downloads = 1
 
16
    remove_javascript      = True
 
17
    use_embedded_content   = False
 
18
    no_stylesheets         = True
 
19
 
 
20
    #masthead_url = 'http://www.sltrib.com/csp/cms/sites/sltrib/assets/images/logo_main.png'
 
21
    #cover_url = 'http://webmedia.newseum.org/newseum-multimedia/dfp/jpg9/lg/UT_SLT.jpg'
 
22
 
 
23
    keep_only_tags = [dict(name='div',attrs={'id':'imageBox'})
 
24
                      ,dict(name='div',attrs={'class':'headline'})
 
25
                      ,dict(name='div',attrs={'class':'byline'})
 
26
                      ,dict(name='p',attrs={'class':'TEXT_w_Indent'})]
 
27
 
 
28
    feeds = [(u'SL Tribune Today', u'http://www.sltrib.com/csp/cms/sites/sltrib/RSS/rss.csp?cat=All'),
 
29
           (u'Utah News', u'http://www.sltrib.com/csp/cms/sites/sltrib/RSS/rss.csp?cat=UtahNews'),
 
30
           (u'Business News', u'http://www.sltrib.com/csp/cms/sites/sltrib/RSS/rss.csp?cat=Money'),
 
31
           (u'Technology', u'http://www.sltrib.com/csp/cms/sites/sltrib/RSS/rss.csp?cat=Technology'),
 
32
           (u'Most Popular', u'http://www.sltrib.com/csp/cms/sites/sltrib/RSS/rsspopular.csp'),
 
33
           (u'Sports', u'http://www.sltrib.com/csp/cms/sites/sltrib/RSS/rss.csp?cat=Sports')]
 
34
 
 
35
    extra_css = '''
 
36
                .headline{font-family:Arial,Helvetica,sans-serif; font-size:xx-large; font-weight: bold; color:#0E5398;}
 
37
                .byline{font-family:Arial,Helvetica,sans-serif; color:#333333; font-size:xx-small;}
 
38
                .storytext{font-family:Arial,Helvetica,sans-serif; font-size:medium;}
 
39
                '''
 
40
 
 
41
    def print_version(self, url):
 
42
        seg = url.split('/')
 
43
        x = seg[5].split('-')
 
44
        baseURL = 'http://www.sltrib.com/csp/cms/sites/sltrib/pages/printerfriendly.csp?id='
 
45
        s = baseURL + x[0]
 
46
        return s
 
47
 
 
48
    def get_cover_url(self):
 
49
        cover_url = None
 
50
        href =  'http://www.newseum.org/todaysfrontpages/hr.asp?fpVname=UT_SLT&ref_pge=lst'
 
51
        soup = self.index_to_soup(href)
 
52
        div = soup.find('div',attrs={'class':'tfpLrgView_container'})
 
53
        if div:
 
54
            cover_url = div.img['src']
 
55
        return cover_url
 
56