| 1 |
from calibre.web.feeds.news import BasicNewsRecipe |
| 2 |
|
| 3 |
|
| 4 |
def classes(classes): |
| 5 |
q = frozenset(classes.split(' ')) |
| 6 |
return dict(attrs={'class': lambda x: x and frozenset(x.split()).intersection(q)}) |
| 7 |
|
| 8 |
|
| 9 |
class DawnRecipe(BasicNewsRecipe): |
| 10 |
__license__ = 'GPL v3' |
| 11 |
__author__ = 'kwetal' |
| 12 |
language = 'en_PK' |
| 13 |
version = 1 |
| 14 |
|
| 15 |
title = 'Dawn' |
| 16 |
publisher = 'Dawn Media Group' |
| 17 |
category = 'News, Pakistan' |
| 18 |
description = 'Leading English Newspaper of Pakistan covering national & international news' |
| 19 |
|
| 20 |
use_embedded_content = False |
| 21 |
remove_empty_feeds = True |
| 22 |
oldest_article = 2 |
| 23 |
max_articles_per_feed = 100 |
| 24 |
|
| 25 |
no_stylesheets = True |
| 26 |
remove_javascript = True |
| 27 |
encoding = 'utf-8' |
| 28 |
keep_only_tags = [classes('template__header template__main')] |
| 29 |
# Feeds from |
| 30 |
# http://www.dawn.com/wps/wcm/connect/dawn-content-library/dawn/services/rss |
| 31 |
feeds = [] |
| 32 |
feeds.append(('Latest News', 'http://feeds.feedburner.com/dawn-news')) |
| 33 |
|
| 34 |
conversion_options = {'comments': description, 'tags': category, 'language': 'en', 'publisher': publisher} |
| 35 |
|
| 36 |
extra_css = ''' |
| 37 |
body{font-family:verdana,arial,helvetica,geneva,sans-serif;} |
| 38 |
center {font-size: xx-small; color: #666666;} |
| 39 |
strong {font-size: small; font-weight: bold;} |
| 40 |
span.news_headline {font-size: xx-large; font-weight: bold; margin: 0em; padding: 0em} |
| 41 |
span.news_byline {font-size: x-small; color: #696969; margin-top: 1em;} |
| 42 |
''' |