mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
a85c0e5ffb
commit
e8e4246860
@ -1,19 +1,38 @@
|
|||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
import re
|
||||||
class Adventure_zone(BasicNewsRecipe):
|
class Adventure_zone(BasicNewsRecipe):
|
||||||
title = u'Adventure Zone'
|
title = u'Adventure Zone'
|
||||||
__author__ = 'fenuks'
|
__author__ = 'fenuks'
|
||||||
description = 'Adventure zone - adventure games from A to Z'
|
description = 'Adventure zone - adventure games from A to Z'
|
||||||
category = 'games'
|
category = 'games'
|
||||||
language = 'pl'
|
language = 'pl'
|
||||||
oldest_article = 15
|
|
||||||
max_articles_per_feed = 100
|
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
|
oldest_article = 20
|
||||||
|
max_articles_per_feed = 100
|
||||||
|
use_embedded_content=False
|
||||||
|
preprocess_regexps = [(re.compile(r"<td class='capmain'>Komentarze</td>", re.IGNORECASE), lambda m: '')]
|
||||||
remove_tags_before= dict(name='td', attrs={'class':'main-bg'})
|
remove_tags_before= dict(name='td', attrs={'class':'main-bg'})
|
||||||
remove_tags_after= dict(name='td', attrs={'class':'main-body middle-border'})
|
remove_tags= [dict(name='img', attrs={'alt':'Drukuj'})]
|
||||||
|
remove_tags_after= dict(id='comments')
|
||||||
extra_css = '.main-bg{text-align: left;} td.capmain{ font-size: 22px; }'
|
extra_css = '.main-bg{text-align: left;} td.capmain{ font-size: 22px; }'
|
||||||
feeds = [(u'Nowinki', u'http://www.adventure-zone.info/fusion/feeds/news.php')]
|
feeds = [(u'Nowinki', u'http://www.adventure-zone.info/fusion/feeds/news.php')]
|
||||||
|
|
||||||
|
def parse_feeds (self):
|
||||||
|
feeds = BasicNewsRecipe.parse_feeds(self)
|
||||||
|
soup=self.index_to_soup(u'http://www.adventure-zone.info/fusion/feeds/news.php')
|
||||||
|
tag=soup.find(name='channel')
|
||||||
|
titles=[]
|
||||||
|
for r in tag.findAll(name='image'):
|
||||||
|
r.extract()
|
||||||
|
art=tag.findAll(name='item')
|
||||||
|
for i in art:
|
||||||
|
titles.append(i.title.string)
|
||||||
|
for feed in feeds:
|
||||||
|
for article in feed.articles[:]:
|
||||||
|
article.title=titles[feed.articles.index(article)]
|
||||||
|
return feeds
|
||||||
|
|
||||||
|
|
||||||
def get_cover_url(self):
|
def get_cover_url(self):
|
||||||
soup = self.index_to_soup('http://www.adventure-zone.info/fusion/news.php')
|
soup = self.index_to_soup('http://www.adventure-zone.info/fusion/news.php')
|
||||||
cover=soup.find(id='box_OstatninumerAZ')
|
cover=soup.find(id='box_OstatninumerAZ')
|
||||||
@ -22,17 +41,10 @@ class Adventure_zone(BasicNewsRecipe):
|
|||||||
|
|
||||||
|
|
||||||
def skip_ad_pages(self, soup):
|
def skip_ad_pages(self, soup):
|
||||||
skip_tag = soup.body.findAll(name='a')
|
skip_tag = soup.body.find(name='td', attrs={'class':'main-bg'})
|
||||||
if skip_tag is not None:
|
skip_tag = skip_tag.findAll(name='a')
|
||||||
for r in skip_tag:
|
for r in skip_tag:
|
||||||
if 'articles.php?' in r['href']:
|
if r.strong:
|
||||||
if r.strong is not None:
|
word=r.strong.string
|
||||||
word=r.strong.string
|
if word and (('zapowied' in word) or ('recenzj' in word) or ('solucj' in word)):
|
||||||
if ('zapowied' or 'recenzj') in word:
|
return self.index_to_soup('http://www.adventure-zone.info/fusion/print.php?type=A&item'+r['href'][r['href'].find('article_id')+7:], raw=True)
|
||||||
return self.index_to_soup('http://www.adventure-zone.info/fusion/print.php?type=A&item_id'+r['href'][r['href'].find('_id')+3:], raw=True)
|
|
||||||
else:
|
|
||||||
None
|
|
||||||
|
|
||||||
def print_version(self, url):
|
|
||||||
return url.replace('news.php?readmore', 'print.php?type=N&item_id')
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
|||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
class AstroNEWS(BasicNewsRecipe):
|
class AstroNEWS(BasicNewsRecipe):
|
||||||
title = u'AstroNEWS'
|
title = u'AstroNEWS'
|
||||||
__author__ = 'fenuks'
|
__author__ = 'fenuks'
|
||||||
@ -8,11 +7,16 @@ class AstroNEWS(BasicNewsRecipe):
|
|||||||
language = 'pl'
|
language = 'pl'
|
||||||
oldest_article = 8
|
oldest_article = 8
|
||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
auto_cleanup = True
|
#extra_css= 'table {text-align: left;}'
|
||||||
|
no_stylesheets=True
|
||||||
cover_url='http://news.astronet.pl/img/logo_news.jpg'
|
cover_url='http://news.astronet.pl/img/logo_news.jpg'
|
||||||
# no_stylesheets= True
|
remove_tags=[dict(name='hr')]
|
||||||
feeds = [(u'Wiadomości', u'http://news.astronet.pl/rss.cgi')]
|
feeds = [(u'Wiadomości', u'http://news.astronet.pl/rss.cgi')]
|
||||||
|
|
||||||
def print_version(self, url):
|
def print_version(self, url):
|
||||||
return url.replace('astronet.pl/', 'astronet.pl/print.cgi?')
|
return url.replace('astronet.pl/', 'astronet.pl/print.cgi?')
|
||||||
|
|
||||||
|
def preprocess_html(self, soup):
|
||||||
|
for item in soup.findAll(align=True):
|
||||||
|
del item['align']
|
||||||
|
return soup
|
||||||
|
@ -12,8 +12,9 @@ class Focus_pl(BasicNewsRecipe):
|
|||||||
cover_url=''
|
cover_url=''
|
||||||
remove_empty_feeds= True
|
remove_empty_feeds= True
|
||||||
no_stylesheets=True
|
no_stylesheets=True
|
||||||
remove_tags_before=dict(name='div', attrs={'class':'h2 h2f'})
|
#remove_tags_before=dict(name='div', attrs={'class':'h2 h2f'})
|
||||||
remove_tags_after=dict(name='div', attrs={'class':'clear'})
|
#remove_tags_after=dict(name='div', attrs={'class':'clear'})
|
||||||
|
keep_only_tags=[dict(name='div', attrs={'class':['h2 h2f', 'news-left', 'news-right']})]
|
||||||
feeds = [(u'Wszystkie kategorie', u'http://focus.pl.feedsportal.com/c/32992/f/532692/index.rss'),
|
feeds = [(u'Wszystkie kategorie', u'http://focus.pl.feedsportal.com/c/32992/f/532692/index.rss'),
|
||||||
(u'Nauka', u'http://focus.pl.feedsportal.com/c/32992/f/532693/index.rss'),
|
(u'Nauka', u'http://focus.pl.feedsportal.com/c/32992/f/532693/index.rss'),
|
||||||
(u'Historia', u'http://focus.pl.feedsportal.com/c/32992/f/532694/index.rss'),
|
(u'Historia', u'http://focus.pl.feedsportal.com/c/32992/f/532694/index.rss'),
|
||||||
@ -23,35 +24,33 @@ class Focus_pl(BasicNewsRecipe):
|
|||||||
(u'Przyroda', u'http://focus.pl.feedsportal.com/c/32992/f/532698/index.rss'),
|
(u'Przyroda', u'http://focus.pl.feedsportal.com/c/32992/f/532698/index.rss'),
|
||||||
(u'Technologie', u'http://focus.pl.feedsportal.com/c/32992/f/532699/index.rss'),
|
(u'Technologie', u'http://focus.pl.feedsportal.com/c/32992/f/532699/index.rss'),
|
||||||
(u'Warto wiedzieć', u'http://focus.pl.feedsportal.com/c/32992/f/532700/index.rss'),
|
(u'Warto wiedzieć', u'http://focus.pl.feedsportal.com/c/32992/f/532700/index.rss'),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
]
|
|
||||||
|
|
||||||
def skip_ad_pages(self, soup):
|
def skip_ad_pages(self, soup):
|
||||||
tag=soup.find(name='a')
|
if 'Advertisement' in soup.title:
|
||||||
if tag:
|
tag=soup.find(name='a')
|
||||||
new_soup=self.index_to_soup(tag['href']+ 'do-druku/1/', raw=True)
|
if tag:
|
||||||
return new_soup
|
new_soup=self.index_to_soup(tag['href']+ 'do-druku/1/', raw=True)
|
||||||
|
return new_soup
|
||||||
|
|
||||||
def append_page(self, appendtag):
|
def append_page(self, appendtag):
|
||||||
tag=appendtag.find(name='div', attrs={'class':'arrows'})
|
tag=appendtag.find(name='div', attrs={'class':'arrows'})
|
||||||
if tag:
|
if tag:
|
||||||
nexturl='http://www.focus.pl/'+tag.a['href']
|
nexturl='http://www.focus.pl/'+tag.a['href']
|
||||||
for rem in appendtag.findAll(name='div', attrs={'class':'klik-nav'}):
|
for rem in appendtag.findAll(name='div', attrs={'class':'klik-nav'}):
|
||||||
rem.extract()
|
rem.extract()
|
||||||
while nexturl:
|
while nexturl:
|
||||||
soup2=self.index_to_soup(nexturl)
|
soup2=self.index_to_soup(nexturl)
|
||||||
nexturl=None
|
nexturl=None
|
||||||
pagetext=soup2.find(name='div', attrs={'class':'txt'})
|
pagetext=soup2.find(name='div', attrs={'class':'txt'})
|
||||||
tag=pagetext.find(name='div', attrs={'class':'arrows'})
|
tag=pagetext.find(name='div', attrs={'class':'arrows'})
|
||||||
for r in tag.findAll(name='a'):
|
for r in tag.findAll(name='a'):
|
||||||
if u'Następne' in r.string:
|
if u'Następne' in r.string:
|
||||||
nexturl='http://www.focus.pl/'+r['href']
|
nexturl='http://www.focus.pl/'+r['href']
|
||||||
for rem in pagetext.findAll(name='div', attrs={'class':'klik-nav'}):
|
for rem in pagetext.findAll(name='div', attrs={'class':'klik-nav'}):
|
||||||
rem.extract()
|
rem.extract()
|
||||||
pos = len(appendtag.contents)
|
pos = len(appendtag.contents)
|
||||||
appendtag.insert(pos, pagetext)
|
appendtag.insert(pos, pagetext)
|
||||||
|
|
||||||
def get_cover_url(self):
|
def get_cover_url(self):
|
||||||
soup=self.index_to_soup('http://www.focus.pl/magazyn/')
|
soup=self.index_to_soup('http://www.focus.pl/magazyn/')
|
||||||
|
@ -7,6 +7,7 @@ class naczytniki(BasicNewsRecipe):
|
|||||||
language = 'pl'
|
language = 'pl'
|
||||||
description ='everything about e-readers'
|
description ='everything about e-readers'
|
||||||
category='readers'
|
category='readers'
|
||||||
|
no_stylesheets=True
|
||||||
oldest_article = 7
|
oldest_article = 7
|
||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
remove_tags_after= dict(name='div', attrs={'class':'sociable'})
|
remove_tags_after= dict(name='div', attrs={'class':'sociable'})
|
||||||
|
@ -1,20 +1,21 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
class Nowa_Fantastyka(BasicNewsRecipe):
|
class Nowa_Fantastyka(BasicNewsRecipe):
|
||||||
title = u'Nowa Fantastyka'
|
title = u'Nowa Fantastyka'
|
||||||
oldest_article = 7
|
oldest_article = 7
|
||||||
__author__ = 'fenuks'
|
__author__ = 'fenuks'
|
||||||
language = 'pl'
|
language = 'pl'
|
||||||
|
encoding='latin2'
|
||||||
description ='site for fantasy readers'
|
description ='site for fantasy readers'
|
||||||
category='fantasy'
|
category='fantasy'
|
||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
INDEX='http://www.fantastyka.pl/'
|
INDEX='http://www.fantastyka.pl/'
|
||||||
|
no_stylesheets=True
|
||||||
|
needs_subscription = 'optional'
|
||||||
remove_tags_before=dict(attrs={'class':'belka1-tlo-md'})
|
remove_tags_before=dict(attrs={'class':'belka1-tlo-md'})
|
||||||
#remove_tags_after=dict(name='span', attrs={'class':'naglowek-oceny'})
|
#remove_tags_after=dict(name='span', attrs={'class':'naglowek-oceny'})
|
||||||
remove_tags_after=dict(name='td', attrs={'class':'belka1-bot'})
|
remove_tags_after=dict(name='td', attrs={'class':'belka1-bot'})
|
||||||
remove_tags=[dict(attrs={'class':'avatar2'})]
|
remove_tags=[dict(attrs={'class':'avatar2'}), dict(name='span', attrs={'class':'alert-oceny'}), dict(name='img', attrs={'src':['obrazki/sledz1.png', 'obrazki/print.gif', 'obrazki/mlnf.gif']}), dict(name='b', text='Dodaj komentarz'),dict(name='a', attrs={'href':'http://www.fantastyka.pl/10,1727.html'})]
|
||||||
feeds = []
|
|
||||||
|
|
||||||
def find_articles(self, url):
|
def find_articles(self, url):
|
||||||
articles = []
|
articles = []
|
||||||
@ -45,3 +46,13 @@ class Nowa_Fantastyka(BasicNewsRecipe):
|
|||||||
cover=soup.find(name='img', attrs={'class':'okladka'})
|
cover=soup.find(name='img', attrs={'class':'okladka'})
|
||||||
self.cover_url=self.INDEX+ cover['src']
|
self.cover_url=self.INDEX+ cover['src']
|
||||||
return getattr(self, 'cover_url', self.cover_url)
|
return getattr(self, 'cover_url', self.cover_url)
|
||||||
|
|
||||||
|
def get_browser(self):
|
||||||
|
br = BasicNewsRecipe.get_browser()
|
||||||
|
if self.username is not None and self.password is not None:
|
||||||
|
br.open('http://www.fantastyka.pl/')
|
||||||
|
br.select_form(nr=0)
|
||||||
|
br['login'] = self.username
|
||||||
|
br['pass'] = self.password
|
||||||
|
br.submit()
|
||||||
|
return br
|
||||||
|
@ -8,8 +8,8 @@ class SpidersWeb(BasicNewsRecipe):
|
|||||||
cover_url = 'http://www.spidersweb.pl/wp-content/themes/spiderweb/img/Logo.jpg'
|
cover_url = 'http://www.spidersweb.pl/wp-content/themes/spiderweb/img/Logo.jpg'
|
||||||
category = 'IT, WEB'
|
category = 'IT, WEB'
|
||||||
language = 'pl'
|
language = 'pl'
|
||||||
|
no_stylesheers=True
|
||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
remove_tags_before=dict(name="h1", attrs={'class':'Title'})
|
keep_only_tags=[dict(id='Post')]
|
||||||
remove_tags_after=dict(name="div", attrs={'class':'Text'})
|
remove_tags=[dict(name='div', attrs={'class':['Comments', 'Shows', 'Post-Tags']})]
|
||||||
remove_tags=[dict(name='div', attrs={'class':['Tags', 'CommentCount FloatL', 'Show FloatL']})]
|
|
||||||
feeds = [(u'Wpisy', u'http://www.spidersweb.pl/feed')]
|
feeds = [(u'Wpisy', u'http://www.spidersweb.pl/feed')]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user