Thread: Metro UK change
View Single Post
Old 06-20-2015, 04:08 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: 241
Karma: 1001369
Join Date: Sep 2010
Device: prs300, kindle keyboard 3g
Metro UK change

metro uk recipe change.
fetch was taking an eon, now use feed43

Spoiler:

Code:
class AdvancedUserRecipe1390146870(BasicNewsRecipe):
    title          = u'Metro UK'
    # 20.6.2015 rss using feed 43  - D Asbury
    # item repeatable string = <h3 class="title"><a href="{%}" {*}<span class="colour">{%}</span></a></h3>
    oldest_article = 1
    max_articles_per_feed = 10
    scale_news_images_to_device = True
    compress_news_images = True
    compress_news_images_max_size = 16
    ignore_duplicate_articles = {'title', 'url'}
    masthead_url = 'http://cdn.images.dailyexpress.co.uk/img/page/express_logo.png'
    auto_cleanup = True
    no_stylesheets        = True
    cover_url = 'https://lh4.ggpht.com/aaKY88SbQyB-vK-pgjo22-QVi6dUnOt7aVsRueTU8Fg-zPwOdsDdOVElGM8O0BBDSIsuB9rciyc=w300'
    masthead_url        = 'http://s1.wp.com/wp-content/themes/vip/metrouk/img/branding/metro_logo_300x95.png?m=1363331170g'
    
    preprocess_regexps = [
		 (re.compile(r'\| Metro News', re.IGNORECASE | re.DOTALL), lambda match: ''),
         	
         		]
 
    feeds          = [
		(u'UK','http://feed43.com/5636207287684703.xml'),# 'http://metro.co.uk/news/uk/rss'),
		(u'World News','http://feed43.com/4555301018714738.xml'),
		(u'Weird', 'http://feed43.com/0483673464615441.xml'),
		(u'Sport', 'http://feed43.com/4655536887165433.xml'),
		(u'Entertainment', 'http://feed43.com/6342124113153248.xml'),
		(u'Lifestyle','http://feed43.com/6270456216605466.xml'),
		]

# starsons code
    def parse_feeds (self): 
      feeds = BasicNewsRecipe.parse_feeds(self) 
      for feed in feeds:
        for article in feed.articles[:]:
          print 'article.title is: ', article.title
          if 'VIDEO:' in article.title.upper():
            feed.articles.remove(article)
          
      return feeds


    extra_css = '''
                    h1{font-weight:bold;font-size:175%;}
                    h2{display: block;margin-left: auto;margin-right: auto;width:125%;font-weight:bold;font-size:150%;}
                    #p{font-size:14px;}
                    #body{font-size:14px;}
                    .figcaption {display: block;margin-left: auto;margin-right: auto;width:100%;font-size:40%;}
                    .alignnone{display: block;margin-left: auto;margin-right: auto;width:100%;font-size:40%;}
                    .publish-info {font-size:50%;}
                    .aligncenter{display: block;margin-left: auto;margin-right: auto;width:100%;}
      '''

Last edited by scissors; 06-20-2015 at 05:10 AM. Reason: lifestyle feed corrected
scissors is offline   Reply With Quote