# -*- coding: utf-8 -*- from calibre.web.feeds.news import BasicNewsRecipe class Haber7 (BasicNewsRecipe): title = u'Haber 7' __author__ = u'thomass' description = ' Haber 7 sitesinden haberler ' oldest_article = 2 max_articles_per_feed = 100 no_stylesheets = True encoding = 'ISO 8859-9' publisher = 'thomass' category = 'güncel, haber, türkçe' language = 'tr' publication_type = 'newspaper' conversion_options = { 'tags': category, 'language': language, 'publisher': publisher, 'linearize_tables': True } extra_css = 'body{ font-size: 12px}h2{font-weight: bold; font-size: 18px;color:#0000FF} #newsheadcon h1{font-weight: bold; font-size: 18px;color:#0000FF}' keep_only_tags = [ dict(name='div', attrs={'class': ['intNews', 'leftmidmerge']})] remove_tags = [dict(name='div', attrs={'id': ['blocktitle', 'banner46860body']}), dict(name='div', attrs={'class': ['Breadcrumb', 'shr', 'mobile/home.jpg', 'etiket', 'yorumYazNew', 'shr', 'y-list', 'banner', 'lftBannerShowcase', 'comments', 'interNews', 'lftBanner', 'midblock', 'rightblock', 'comnum', 'commentcon', ]}), dict(name='a', attrs={'class': ['saveto', 'sendto', 'comlink', 'newsshare', ]}), dict(name='iframe', attrs={'name': ['frm111', 'frm107']}), dict(name='ul', attrs={'class': ['nocPagi', 'leftmidmerge']})] # noqa cover_img_url = 'http://dl.dropbox.com/u/39726752/haber7.JPG' masthead_url = 'http://dl.dropbox.com/u/39726752/haber7.JPG' remove_empty_feeds = True feeds = [ (u'Siyaset', u'http://open.dapper.net/services/h7siyaset'), (u'Güncel', u'http://open.dapper.net/services/h7guncel'), (u'Yaşam', u'http://open.dapper.net/services/h7yasam'), (u'Ekonomi', u'http://open.dapper.net/services/h7ekonomi'), (u'3. Sayfa', u'http://open.dapper.net/services/h73sayfa'), (u'Dünya', u'http://open.dapper.net/services/h7dunya'), (u'Medya', u'http://open.dapper.net/services/h7medya'), (u'Yazarlar', u'http://open.dapper.net/services/h7yazarlar'), (u'Bilim', u'http://open.dapper.net/services/h7bilim'), (u'Eğitim', u'http://open.dapper.net/services/h7egitim'), (u'Spor', u'http://open.dapper.net/services/h7sporv3'), ] def preprocess_html(self, soup): for alink in soup.findAll('a'): if alink.string is not None: tstr = alink.string alink.replaceWith(tstr) return soup