mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
New recipe for LWN by Oliver Niesner
This commit is contained in:
parent
2f476f007a
commit
72ceac8117
BIN
resources/images/news/lwn.png
Normal file
BIN
resources/images/news/lwn.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 387 B |
55
resources/recipes/lwn.recipe
Normal file
55
resources/recipes/lwn.recipe
Normal file
@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
'''
|
||||
lwn.net
|
||||
'''
|
||||
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
|
||||
class LWN(BasicNewsRecipe):
|
||||
title = u'lwn'
|
||||
__author__ = 'Oliver Niesner'
|
||||
description = 'Linux Weekly News'
|
||||
oldest_article = 54
|
||||
language = _('English')
|
||||
max_articles_per_feed = 100
|
||||
needs_subscription = True
|
||||
language = 'en'
|
||||
remove_javascript = True
|
||||
simultaneous_downloads= 1
|
||||
delay = 1
|
||||
LOGIN = 'https://lwn.net/login'
|
||||
|
||||
def get_browser(self):
|
||||
br = BasicNewsRecipe.get_browser()
|
||||
if self.username is not None and self.password is not None:
|
||||
br.open(self.LOGIN)
|
||||
br.select_form(name='loginform')
|
||||
br['Username'] = self.username
|
||||
br['Password'] = self.password
|
||||
br.submit()
|
||||
return br
|
||||
|
||||
remove_tags = [
|
||||
dict(name='td', attrs={'class':'LeftColumn'}),
|
||||
dict(name='td', attrs={'class':'NavLink'}),
|
||||
dict(name='div', attrs={'class':'FormattedComment'}),
|
||||
dict(name='td', attrs={'class':'MCTopBanner'}),
|
||||
dict(name='div', attrs={'class':'CommentBox'})
|
||||
]
|
||||
|
||||
feeds = [
|
||||
(u'lwn' , u'http://lwn.net/headlines/newrss' ),
|
||||
]
|
||||
|
||||
|
||||
|
||||
def postprocess_html(self, soup, first):
|
||||
for tag in soup.findAll(name=['table', 'tr', 'td']):
|
||||
tag.name = 'div'
|
||||
return soup
|
||||
|
||||
def print_version(self, url):
|
||||
return url.replace ('rss', '?format=printable')
|
Loading…
x
Reference in New Issue
Block a user