Debian Codegraph @

recipes/bangkokpost.recipe

raw
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 BangkokPostRecipe(BasicNewsRecipe):
10 __license__ = 'GPL v3'
11 __author__ = 'kwetal'
12 language = 'en_TH'
13 version = 1
14
15 title = 'Bangkok Post'
16 publisher = 'Post Publishing PCL'
17 category = 'News'
18 description = "The world's window to Thailand"
19
20 oldest_article = 7
21 max_articles_per_feed = 100
22
23 no_stylesheets = True
24 remove_javascript = True
25 use_embedded_content = False
26
27 # Feeds from: http://www.bangkokpost.com/rss/
28 feeds = []
29 feeds.append(('Breaking News', 'http://www.bangkokpost.com/rss/data/breakingnews.xml'))
30 feeds.append(('Top Stories', 'http://www.bangkokpost.com/rss/data/topstories.xml'))
31 feeds.append(('News', 'http://www.bangkokpost.com/rss/data/news.xml'))
32 feeds.append(('Business', 'http://www.bangkokpost.com/rss/data/business.xml'))
33 feeds.append(('Opinion', 'http://www.bangkokpost.com/rss/data/opinion.xml'))
34 feeds.append(('Travel', 'http://www.bangkokpost.com/rss/data/travel.xml'))
35 feeds.append(('Leisure', 'http://www.bangkokpost.com/rss/data/leisure.xml'))
36 feeds.append(('Entertainment', 'http://www.bangkokpost.com/rss/data/entertainment.xml'))
37 feeds.append(('Auto', 'http://www.bangkokpost.com/rss/data/auto.xml'))
38 feeds.append(('Life', 'http://www.bangkokpost.com/rss/data/life.xml'))
39 feeds.append(('Tech', 'http://www.bangkokpost.com/rss/data/tect.xml'))
40
41 keep_only_tags = [
42 classes('article-headline article-content'),
43 ]
44
45 def print_version(self, url):
46 if '.com/vdo/' in url:
47 url = None
48 return url