Debian Codegraph @

recipes/apod.recipe

raw
1 from calibre.web.feeds.news import BasicNewsRecipe
2
3
4 class APOD(BasicNewsRecipe):
5 title = 'Astronomy Picture of the Day'
6 __author__ = 'Starson17'
7 description = 'Astronomy Pictures'
8 language = 'en'
9 use_embedded_content = False
10 no_stylesheets = True
11 cover_url = 'http://apod.nasa.gov/apod/image/1003/m78_torregrosa.jpg'
12 remove_javascript = True
13 recursions = 0
14 oldest_article = 14
15 remove_attributes = ['onmouseover', 'onmouseout']
16
17 feeds = [('Astronomy Picture of the Day', 'http://apod.nasa.gov/apod.rss')]
18
19 extra_css = '''
20 h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
21 h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;}
22 p{font-family:Arial,Helvetica,sans-serif;font-size:small;}
23 body{font-family:Helvetica,Arial,sans-serif;font-size:small;}
24 '''
25
26 def postprocess_html(self, soup, first_fetch):
27 center_tags = soup.findAll(['center'])
28 p_tags = soup.findAll(['p'])
29 last_center = center_tags[-1:]
30 last_center[0].extract()
31 first_p = p_tags[:1]
32 for tag in first_p:
33 tag.extract()
34 last2_p = p_tags[-2:]
35 for tag in last2_p:
36 tag.extract()
37 return soup