Debian Codegraph @

recipes/kyungyhang.recipe

raw
1 # -*- coding: utf-8 -*-
2 __license__ = 'GPL v3'
3 __copyright__ = '2011, Seongkyoun Yoo <seongkyoun.yoo at gmail.com>'
4 '''
5 Profile to download The Kyungyhang
6 '''
7
8 import re
9
10 from calibre.web.feeds.news import BasicNewsRecipe
11
12
13 class Kyungyhang(BasicNewsRecipe):
14 title = 'Kyungyhang'
15 language = 'ko'
16 description = 'The Kyungyhang Shinmun articles'
17 __author__ = 'Seongkyoun Yoo'
18 oldest_article = 7
19 max_articles_per_feed = 10
20 no_stylesheets = True
21 remove_javascript = True
22
23 preprocess_regexps = [
24 (re.compile(r"<div class='ad_movFocus'.*</html>", re.DOTALL | re.IGNORECASE), lambda match: '</html>'),
25 ]
26
27 keep_only_tags = [
28 dict(name='div', attrs={'class': ['article_title_wrap']}),
29 dict(name='div', attrs={'class': ['viewHeader']}),
30 dict(name='span', attrs={'class': ['article_txt']}),
31 ]
32
33 remove_tags_after = dict(id={'sub_bottom'})
34
35 remove_tags = [
36 dict(name='div', attrs={'class': ['widget_top_dable']}),
37 dict(name='div', attrs={'class': ['article_bottom_ad']}),
38 dict(name='div', attrs={'class': ['article_date']}),
39 dict(name='iframe'),
40 dict(id={'TdHot'}),
41 dict(name='div', attrs={'class': ['btn_list', 'bline', 'linebottom', 'bestArticle']}),
42 dict(name='dl', attrs={'class': ['CL']}),
43 dict(name='ul', attrs={'class': ['tab']}),
44 ]
45
46 feeds = [
47 ('정치', 'http://www.khan.co.kr/rss/rssdata/politic_news.xml'),
48 ('경제', 'http://www.khan.co.kr/rss/rssdata/economy_news.xml'),
49 ('사회', 'http://www.khan.co.kr/rss/rssdata/society_news.xml'),
50 ('세계', 'http://www.khan.co.kr/rss/rssdata/kh_world.xml'),
51 ('스포츠', 'http://www.khan.co.kr/rss/rssdata/kh_sports.xml'),
52 ('문화', 'http://www.khan.co.kr/rss/rssdata/culture_news.xml'),
53 ('연예', 'http://www.khan.co.kr/rss/rssdata/kh_entertainment.xml'),
54 ('IT', 'http://www.khan.co.kr/rss/rssdata/it_news.xml'),
55 ('오피니언', 'http://www.khan.co.kr/rss/rssdata/opinion_news.xml'),
56 ]