| 1 |
from calibre.web.feeds.recipes import BasicNewsRecipe |
| 2 |
|
| 3 |
|
| 4 |
class AdvancedUserRecipe1303841067(BasicNewsRecipe): |
| 5 |
title = 'Golem.de' |
| 6 |
__author__ = 'schuster' |
| 7 |
|
| 8 |
oldest_article = 7 |
| 9 |
max_articles_per_feed = 10 |
| 10 |
no_stylesheets = True |
| 11 |
use_embedded_content = False |
| 12 |
language = 'de' |
| 13 |
cover_url = 'http://www.e-energy.de/images/logo_golem.jpg' |
| 14 |
masthead_url = 'http://www.golem.de/staticrl/images/logo.png' |
| 15 |
extra_css = ''' |
| 16 |
h2{font-family:Arial,Helvetica,sans-serif; font-size: x-small;} |
| 17 |
h1{ font-family:Arial,Helvetica,sans-serif; font-size:x-large; font-weight:bold;} |
| 18 |
|
| 19 |
''' |
| 20 |
remove_javascript = True |
| 21 |
remove_tags_befor = [dict(name='header', attrs={'class': 'cluster-header'})] |
| 22 |
remove_tags_after = [dict(name='p', attrs={'class': 'meta'})] |
| 23 |
remove_tags = [ |
| 24 |
dict(rel='nofollow'), |
| 25 |
dict(name='header', attrs={'id': 'header'}), |
| 26 |
dict(name='div', attrs={'class': 'dh1'}), |
| 27 |
dict(name='label', attrs={'class': 'implied'}), |
| 28 |
dict(name='section', attrs={'id': 'comments'}), |
| 29 |
dict(name='li', attrs={'class': 'gg_prebackcounterItem'}), |
| 30 |
dict(name='li', attrs={'class': 'gg_prebackcounterItem gg_embeddedIndexCounter'}), |
| 31 |
dict(name='img', attrs={'class': 'gg_embeddedIconRight gg_embeddedIconFS gg_cursorpointer'}), |
| 32 |
dict(name='div', attrs={'target': '_blank'}), |
| 33 |
] |
| 34 |
|
| 35 |
def get_browser(self, *args, **kwargs): |
| 36 |
from calibre import browser |
| 37 |
|
| 38 |
kwargs['user_agent'] = 'mozilla' |
| 39 |
return browser(*args, **kwargs) |
| 40 |
|
| 41 |
def get_article_url(self, article): |
| 42 |
return article.get('id', article.get('guid', None)) |
| 43 |
|
| 44 |
def preprocess_html(self, soup): |
| 45 |
for alink in soup.findAll('a'): |
| 46 |
if alink.string is not None: |
| 47 |
tstr = alink.string |
| 48 |
alink.replaceWith(tstr) |
| 49 |
return soup |
| 50 |
|
| 51 |
feeds = [ |
| 52 |
('Audio/Video', 'http://rss.golem.de/rss.php?tp=av&feed=RSS2.0'), |
| 53 |
('Foto', 'http://rss.golem.de/rss.php?tp=foto&feed=RSS2.0'), |
| 54 |
('Games', 'http://rss.golem.de/rss.php?tp=games&feed=RSS2.0'), |
| 55 |
('Handy', 'http://rss.golem.de/rss.php?tp=handy&feed=RSS2.0'), |
| 56 |
('Internet', 'http://rss.golem.de/rss.php?tp=inet&feed=RSS2.0'), |
| 57 |
('Mobile', 'http://rss.golem.de/rss.php?tp=mc&feed=RSS2.0'), |
| 58 |
('OSS', 'http://rss.golem.de/rss.php?tp=oss&feed=RSS2.0'), |
| 59 |
('Politik/Recht', 'http://rss.golem.de/rss.php?tp=pol&feed=RSS2.0'), |
| 60 |
('Security', 'http://rss.golem.de/rss.php?tp=sec&feed=RSS2.0'), |
| 61 |
('Desktop-Applikationen', 'http://rss.golem.de/rss.php?tp=apps&feed=RSS2.0'), |
| 62 |
('Software-Entwicklung', 'http://rss.golem.de/rss.php?tp=dev&feed=RSS2.0'), |
| 63 |
('Wirtschaft', 'http://rss.golem.de/rss.php?tp=wirtschaft&feed=RSS2.0'), |
| 64 |
('Hardware', 'http://rss.golem.de/rss.php?r=hw&feed=RSS2.0'), |
| 65 |
('Software', 'http://rss.golem.de/rss.php?r=sw&feed=RSS2.0'), |
| 66 |
('Networld', 'http://rss.golem.de/rss.php?r=nw&feed=RSS2.0'), |
| 67 |
('Entertainment', 'http://rss.golem.de/rss.php?r=et&feed=RSS2.0'), |
| 68 |
('TK', 'http://rss.golem.de/rss.php?r=tk&feed=RSS2.0'), |
| 69 |
('Wirtschaft', 'http://rss.golem.de/rss.php?r=wi&feed=RSS2.0'), |
| 70 |
('E-Commerce', 'http://rss.golem.de/rss.php?r=ec&feed=RSS2.0'), |
| 71 |
] |