mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Linux Journal and Conowego.pl by fenuks
This commit is contained in:
parent
3afc065c2a
commit
d13e49b401
38
recipes/conowego_pl.recipe
Executable file
38
recipes/conowego_pl.recipe
Executable file
@ -0,0 +1,38 @@
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
||||
class CoNowegoPl(BasicNewsRecipe):
|
||||
title = u'conowego.pl'
|
||||
__author__ = 'fenuks'
|
||||
description = u'Nowy wortal technologiczny oraz gazeta internetowa. Testy najnowszych produktów, fachowe porady i recenzje. U nas znajdziesz wszystko o elektronice użytkowej !'
|
||||
cover_url = 'http://www.conowego.pl/fileadmin/templates/main/images/logo_top.png'
|
||||
category = 'IT, news'
|
||||
language = 'pl'
|
||||
oldest_article = 7
|
||||
max_articles_per_feed = 100
|
||||
no_stylesheets = True
|
||||
remove_empty_feeds = True
|
||||
use_embedded_content = False
|
||||
keep_only_tags = [dict(name='div', attrs={'class':'news_list single_view'})]
|
||||
remove_tags = [dict(name='div', attrs={'class':['ni_bottom', 'ni_rank', 'ni_date']})]
|
||||
feeds = [(u'Aktualno\u015bci', u'http://www.conowego.pl/rss/aktualnosci-5/?type=100'), (u'Gaming', u'http://www.conowego.pl/rss/gaming-6/?type=100'), (u'Porady', u'http://www.conowego.pl/rss/porady-3/?type=100'), (u'Testy', u'http://www.conowego.pl/rss/testy-2/?type=100')]
|
||||
|
||||
def preprocess_html(self, soup):
|
||||
for i in soup.findAll('img'):
|
||||
i.parent.insert(0, BeautifulSoup('<br />'))
|
||||
i.insert(len(i), BeautifulSoup('<br />'))
|
||||
self.append_page(soup, soup.body)
|
||||
return soup
|
||||
|
||||
|
||||
def append_page(self, soup, appendtag):
|
||||
tag = appendtag.find('div', attrs={'class':'pages'})
|
||||
if tag:
|
||||
nexturls=tag.findAll('a')
|
||||
for nexturl in nexturls[:-1]:
|
||||
soup2 = self.index_to_soup('http://www.conowego.pl/' + nexturl['href'])
|
||||
pagetext = soup2.find(attrs={'class':'ni_content'})
|
||||
pos = len(appendtag.contents)
|
||||
appendtag.insert(pos, pagetext)
|
||||
|
||||
for r in appendtag.findAll(attrs={'class':['pages', 'paginationWrap']}):
|
||||
r.extract()
|
BIN
recipes/icons/conowego_pl.png
Normal file
BIN
recipes/icons/conowego_pl.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 694 B |
BIN
recipes/icons/linux_journal.png
Normal file
BIN
recipes/icons/linux_journal.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 443 B |
36
recipes/linux_journal.recipe
Executable file
36
recipes/linux_journal.recipe
Executable file
@ -0,0 +1,36 @@
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
|
||||
class LinuxJournal(BasicNewsRecipe):
|
||||
title = u'Linux Journal'
|
||||
__author__ = 'fenuks'
|
||||
description = u'The monthly magazine of the Linux community, promoting the use of Linux worldwide.'
|
||||
cover_url = 'http://www.linuxjournal.com/files/linuxjournal.com/ufiles/logo-lj.jpg'
|
||||
category = 'IT, Linux'
|
||||
language = 'en'
|
||||
oldest_article = 7
|
||||
max_articles_per_feed = 100
|
||||
no_stylesheets = True
|
||||
use_embedded_content = False
|
||||
remove_empty_feeds = True
|
||||
keep_only_tags=[dict(id='content-inner')]
|
||||
remove_tags_after= dict(attrs={'class':'user-signature clear-block'})
|
||||
remove_tags=[dict(attrs={'class':['user-signature clear-block', 'breadcrumb', 'terms terms-inline']})]
|
||||
feeds = [(u'Front Page', u'http://feeds.feedburner.com/linuxjournalcom'), (u'News', u'http://feeds.feedburner.com/LinuxJournal-BreakingNews'), (u'Blogs', u'http://www.linuxjournal.com/blog/feed'), (u'Audio/Video', u'http://www.linuxjournal.com/taxonomy/term/28/0/feed'), (u'Community', u'http://www.linuxjournal.com/taxonomy/term/18/0/feed'), (u'Education', u'http://www.linuxjournal.com/taxonomy/term/25/0/feed'), (u'Embedded', u'http://www.linuxjournal.com/taxonomy/term/27/0/feed'), (u'Hardware', u'http://www.linuxjournal.com/taxonomy/term/23/0/feed'), (u'HOWTOs', u'http://www.linuxjournal.com/taxonomy/term/19/0/feed'), (u'International', u'http://www.linuxjournal.com/taxonomy/term/30/0/feed'), (u'Security', u'http://www.linuxjournal.com/taxonomy/term/31/0/feed'), (u'Software', u'http://www.linuxjournal.com/taxonomy/term/17/0/feed'), (u'Sysadmin', u'http://www.linuxjournal.com/taxonomy/term/21/0/feed'), (u'Webmaster', u'http://www.linuxjournal.com/taxonomy/term/24/0/feed')]
|
||||
|
||||
def append_page(self, soup, appendtag):
|
||||
next = appendtag.find('li', attrs={'class':'pager-next'})
|
||||
while next:
|
||||
nexturl = next.a['href']
|
||||
appendtag.find('div', attrs={'class':'links'}).extract()
|
||||
soup2 = self.index_to_soup('http://www.linuxjournal.com'+ nexturl)
|
||||
pagetext = soup2.find(attrs={'class':'node-inner'}).find(attrs={'class':'content'})
|
||||
next = appendtag.find('li', attrs={'class':'pager-next'})
|
||||
pos = len(appendtag.contents)
|
||||
appendtag.insert(pos, pagetext)
|
||||
tag = appendtag.find('div', attrs={'class':'links'})
|
||||
if tag:
|
||||
tag.extract()
|
||||
|
||||
def preprocess_html(self, soup):
|
||||
self.append_page(soup, soup.body)
|
||||
return soup
|
Loading…
x
Reference in New Issue
Block a user