mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Implement #3473 (Please add Dutch news Tweakers.net (techsite))
This commit is contained in:
parent
9e95f7e7f6
commit
a008de7c4e
@ -57,7 +57,7 @@ recipe_modules = ['recipe_' + r for r in (
|
|||||||
'monitor', 'republika', 'beta', 'beta_en', 'glasjavnosti',
|
'monitor', 'republika', 'beta', 'beta_en', 'glasjavnosti',
|
||||||
'esquire', 'livemint', 'thedgesingapore', 'darknet', 'rga',
|
'esquire', 'livemint', 'thedgesingapore', 'darknet', 'rga',
|
||||||
'intelligencer', 'theoldfoodie', 'hln_be', 'honvedelem',
|
'intelligencer', 'theoldfoodie', 'hln_be', 'honvedelem',
|
||||||
'the_new_republic', 'philly', 'salon',
|
'the_new_republic', 'philly', 'salon', 'tweakers',
|
||||||
)]
|
)]
|
||||||
|
|
||||||
|
|
||||||
|
44
src/calibre/web/feeds/recipes/recipe_tweakers.py
Normal file
44
src/calibre/web/feeds/recipes/recipe_tweakers.py
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||||
|
from __future__ import with_statement
|
||||||
|
|
||||||
|
__license__ = 'GPL v3'
|
||||||
|
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||||
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
|
import re
|
||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
class Tweakers(BasicNewsRecipe):
|
||||||
|
title = u'Tweakers.net'
|
||||||
|
__author__ = 'Kovid Goyal'
|
||||||
|
language = 'nl'
|
||||||
|
oldest_article = 4
|
||||||
|
max_articles_per_feed = 40
|
||||||
|
|
||||||
|
keep_only_tags = [dict(name='div', attrs={'class':'columnwrapper news'})]
|
||||||
|
|
||||||
|
remove_tags = [dict(name='div', attrs={'class':'reacties'}),
|
||||||
|
{'id' : ['utracker']},
|
||||||
|
{'class' : ['sidebar']},
|
||||||
|
{'class' : re.compile('nextPrevious')},
|
||||||
|
]
|
||||||
|
no_stylesheets=True
|
||||||
|
|
||||||
|
feeds = [(u'Tweakers.net', u'http://tweakers.net/feeds/nieuws.xml')]
|
||||||
|
|
||||||
|
def preprocess_html(self, soup):
|
||||||
|
for a in soup.findAll('a', href=True, rel=True):
|
||||||
|
if a['rel'].startswith('imageview'):
|
||||||
|
a['src'] = a['href']
|
||||||
|
del a['href']
|
||||||
|
a.name = 'img'
|
||||||
|
for x in a.findAll(True):
|
||||||
|
x.extract()
|
||||||
|
return soup
|
||||||
|
|
||||||
|
def postprocess_html(self, soup, first):
|
||||||
|
for base in soup.findAll('base'):
|
||||||
|
base.extract()
|
||||||
|
return soup
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user