home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Narzedzia / Calibre / calibre-0.8.18.msi / file_280 / rbc_ru.recipe < prev    next >
Text File  |  2011-09-09  |  3KB  |  57 lines

  1. # -*- coding: utf-8 -*-
  2.  
  3. from calibre.web.feeds.news import BasicNewsRecipe
  4.  
  5. class RBC_ru(BasicNewsRecipe):
  6.     title = u'RBC.ru'
  7.     __author__ = 'A. Chewi'
  8.     description = u'╨á╨╛╤ü╤ü╨╕╨╣╤ü╨║╨╛╨╡ ╨╕╨╜╤ä╨╛╤Ç╨╝╨░╤å╨╕╨╛╨╜╨╜╨╛╨╡ ╨░╨│╨╡╨╜╤é╤ü╤é╨▓╨╛ ┬½╨á╨╛╤ü╨æ╨╕╨╖╨╜╨╡╤ü╨Ü╨╛╨╜╤ü╨░╨╗╤é╨╕╨╜╨│┬╗ (╨á╨æ╨Ü) - ╨╗╨╡╨╜╤é╤ï ╨╜╨╛╨▓╨╛╤ü╤é╨╡╨╣ ╨┐╨╛╨╗╨╕╤é╨╕╨║╨╕, ╤ì╨║╨╛╨╜╨╛╨╝╨╕╨║╨╕ ╨╕ ╤ä╨╕╨╜╨░╨╜╤ü╨╛╨▓, ╨░╨╜╨░╨╗╨╕╤é╨╕╤ç╨╡╤ü╨║╨╕╨╡ ╨╝╨░╤é╨╡╤Ç╨╕╨░╨╗╤ï, ╨║╨╛╨╝╨╝╨╡╨╜╤é╨░╤Ç╨╕╨╕ ╨╕ ╨┐╤Ç╨╛╨│╨╜╨╛╨╖╤ï, ╤é╨╡╨╝╨░╤é╨╕╤ç╨╡╤ü╨║╨╕╨╡ ╤ü╤é╨░╤é╤î╨╕'
  9.     needs_subscription = False
  10.     cover_url = 'http://pics.rbc.ru/img/fp_v4/skin/img/logo.gif'
  11.     cover_margins = (80, 160, '#ffffff')
  12.     oldest_article = 10
  13.     max_articles_per_feed = 50
  14.     summary_length = 200
  15.     remove_empty_feeds = True
  16.     no_stylesheets = True
  17.     remove_javascript = True
  18.     use_embedded_content  = False
  19.     conversion_options = {'linearize_tables' : True}
  20.     language = 'ru'
  21.     timefmt = ' [%a, %d %b, %Y]'
  22.  
  23.     feeds = [(u'╨ô╨╗╨░╨▓╨╜╤ï╨╡ ╨╜╨╛╨▓╨╛╤ü╤é╨╕', u'http://static.feed.rbc.ru/rbc/internal/rss.rbc.ru/rbc.ru/mainnews.rss'),
  24.     (u'╨ƒ╨╛╨╗╨╕╤é╨╕╨║╨░', u'http://static.feed.rbc.ru/rbc/internal/rss.rbc.ru/rbc.ru/politics.rss'),
  25.     (u'╨¡╨║╨╛╨╜╨╛╨╝╨╕╨║╨░', u'http://static.feed.rbc.ru/rbc/internal/rss.rbc.ru/rbc.ru/economics.rss'),
  26.     (u'╨₧╨▒╤ë╨╡╤ü╤é╨▓╨╛', u'http://static.feed.rbc.ru/rbc/internal/rss.rbc.ru/rbc.ru/society.rss'),
  27.     (u'╨ƒ╤Ç╨╛╨╕╤ü╤ê╨╡╤ü╤é╨▓╨╕╤Å', u'http://static.feed.rbc.ru/rbc/internal/rss.rbc.ru/rbc.ru/incidents.rss'),
  28.     (u'╨ñ╨╕╨╜╨░╨╜╤ü╨╛╨▓╤ï╨╡ ╨╜╨╛╨▓╨╛╤ü╤é╨╕ Quote.rbc.ru', u'http://static.feed.rbc.ru/rbc/internal/rss.rbc.ru/quote.ru/mainnews.rss')]
  29.  
  30.     keep_only_tags = [dict(name='h2', attrs={}),
  31.     dict(name='div', attrs={'class': 'box _ga1_on_'}),
  32.     dict(name='h1', attrs={'class': 'news_section'}),
  33.     dict(name='div', attrs={'class': 'news_body dotted_border_bottom'}),
  34.     dict(name='table', attrs={'class': 'newsBody'}),
  35.     dict(name='h2', attrs={'class': 'black'})]
  36.  
  37.     remove_tags = [dict(name='div', attrs={'class': "video-frame"}),
  38.     dict(name='div', attrs={'class': "photo-container videoContainer videoSWFLinks videoPreviewSlideContainer notes"}),
  39.     dict(name='div', attrs={'class': "notes"}),
  40.     dict(name='div', attrs={'class': "publinks"}),
  41.     dict(name='a', attrs={'class': "print"}),
  42.     dict(name='div', attrs={'class': "photo-report_new notes newslider"}),
  43.     dict(name='div', attrs={'class': "videoContainer"}),
  44.     dict(name='div', attrs={'class': "videoPreviewSlideContainer"}),
  45.     dict(name='a', attrs={'class': "videoPreviewContainer"}),
  46.     dict(name='a', attrs={'class': "red"}),]
  47.  
  48.     def preprocess_html(self, soup):
  49.         for alink in soup.findAll('a'):
  50.             if alink.string is not None:
  51.                tstr = alink.string
  52.                alink.replaceWith(tstr)
  53.         return soup
  54.  
  55.     def print_version(self, url):
  56.         return url + '?print=true'
  57.