mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Astronomy Pic of the Day by Starson17. Fixes #5045 (New Recipe: Astronomy Picture of the Day)
This commit is contained in:
parent
80cbfb1e41
commit
13a9733d42
37
resources/recipes/apod.recipe
Normal file
37
resources/recipes/apod.recipe
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
class APOD(BasicNewsRecipe):
|
||||||
|
title = u'Astronomy Picture of the Day'
|
||||||
|
__author__ = 'Starson17'
|
||||||
|
description = 'Astronomy Pictures'
|
||||||
|
language = 'en'
|
||||||
|
use_embedded_content = False
|
||||||
|
no_stylesheets = True
|
||||||
|
cover_url = 'http://apod.nasa.gov/apod/image/1003/m78_torregrosa.jpg'
|
||||||
|
remove_javascript = True
|
||||||
|
recursions = 0
|
||||||
|
oldest_article = 14
|
||||||
|
|
||||||
|
feeds = [
|
||||||
|
(u'Astronomy Picture of the Day', u'http://apod.nasa.gov/apod.rss')
|
||||||
|
]
|
||||||
|
|
||||||
|
extra_css = '''
|
||||||
|
h1{font-family:Arial,Helvetica,sans-serif; font-weight:bold;font-size:large;}
|
||||||
|
h2{font-family:Arial,Helvetica,sans-serif; font-weight:normal;font-size:small;}
|
||||||
|
p{font-family:Arial,Helvetica,sans-serif;font-size:small;}
|
||||||
|
body{font-family:Helvetica,Arial,sans-serif;font-size:small;}
|
||||||
|
'''
|
||||||
|
def postprocess_html(self, soup, first_fetch):
|
||||||
|
center_tags = soup.findAll(['center'])
|
||||||
|
p_tags = soup.findAll(['p'])
|
||||||
|
last_center = center_tags[-1:]
|
||||||
|
last_center[0].extract()
|
||||||
|
first_p = p_tags[:1]
|
||||||
|
for tag in first_p:
|
||||||
|
tag.extract()
|
||||||
|
last2_p = p_tags[-2:]
|
||||||
|
for tag in last2_p:
|
||||||
|
tag.extract()
|
||||||
|
return soup
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user