Update various Polish News sources

Merge branch 'master' of https://github.com/t3d/calibre
This commit is contained in:
Kovid Goyal 2019-10-16 04:49:59 +05:30
commit 3aac652c0b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 14 additions and 104 deletions

View File

@ -1,55 +0,0 @@
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
__license__ = 'GPL v3'
__copyright__ = u'Łukasz Grąbczewski 2011-2013'
__version__ = '2.0'
import re
import os
from calibre import walk
from calibre.utils.zipfile import ZipFile
from calibre.ptempfile import PersistentTemporaryFile
from calibre.web.feeds.news import BasicNewsRecipe
class jazzpress(BasicNewsRecipe):
__author__ = u'Łukasz Grąbczewski'
title = 'JazzPRESS'
language = 'pl'
publisher = 'Fundacja Popularyzacji Muzyki Jazzowej EuroJAZZ'
publication_type = 'magazine'
description = u'Internetowa gazeta poświęcona muzyce improwizowanej'
conversion_options = {
'authors': 'Fundacja Popularyzacji Muzyki Jazzowej EuroJAZZ',
'publisher': publisher, 'language': language,
'preserve_cover_aspect_ratio': True, 'remove_first_image': True
}
def build_index(self):
browser = self.get_browser()
browser.open('http://radiojazz.fm/')
# find the link
epublink = browser.find_link(
url_regex=re.compile(r'e_jazzpress\d\d\d\d\_epub'))
# download ebook
self.report_progress(0, _('Downloading ePUB'))
response = browser.follow_link(epublink)
book_file = PersistentTemporaryFile(suffix='.epub')
book_file.write(response.read())
book_file.close()
# convert
self.report_progress(0.2, _('Converting to OEB'))
oeb = self.output_dir + '/INPUT/'
if not os.path.exists(oeb):
os.makedirs(oeb)
with ZipFile(book_file.name) as f:
f.extractall(path=oeb)
for f in walk(oeb):
if f.endswith('.opf'):
return f # convert

View File

@ -14,7 +14,7 @@ class km_blog(BasicNewsRecipe):
__author__ = 'teepel <teepel44@gmail.com>'
language = 'pl'
description = 'Wiadomości z bloga korwin-mikke.pl/blog'
INDEX = 'http://korwin-mikke.pl/blog'
INDEX = 'https://korwin-mikke.pl/blog'
remove_empty_feeds = True
oldest_article = 7
max_articles_per_feed = 100
@ -22,16 +22,8 @@ class km_blog(BasicNewsRecipe):
no_stylesheets = True
remove_empty_feeds = True
feeds = [(u'blog', u'http://korwin-mikke.pl/blog/rss')]
feeds = [(u'blog', u'https://korwin-mikke.pl/blog/rss')]
keep_only_tags = []
# this line should show title of the article, but it doesnt work
keep_only_tags.append(dict(name='div', attrs={'class': 'posts view'}))
keep_only_tags.append(dict(name='div', attrs={'class': 'text'}))
keep_only_tags.append(dict(name='h1'))
keep_only_tags = [dict(name='div', attrs={'class': ['header-standard header-classic single-header', 'post-image', 'post-entry blockquote-style-1']})]
remove_tags = []
remove_tags.append(dict(name='p', attrs={'class': 'float_right'}))
remove_tags.append(dict(name='p', attrs={'class': 'date'}))
remove_tags_after = [(dict(name='div', attrs={'class': 'text'}))]
remove_tags = [dict(name='div', attrs={'class': 'penci-hide-tagupdated'})]

View File

@ -11,43 +11,19 @@ class KrytykaPolitycznaRecipe(BasicNewsRecipe):
category = u'News'
description = u' Lewicowe pismo zaangażowane w bieg spraw publicznych w Polsce.'
cover_url = ''
masthead_url = 'https://krytykapolityczna.pl/file/2015/09/krytyka-logo.png'
remove_empty_feeds = True
no_stylesheets = True
oldest_article = 7
max_articles_per_feed = 100000
max_articles_per_feed = 50
recursions = 0
no_stylesheets = True
remove_javascript = True
simultaneous_downloads = 3
keep_only_tags = []
keep_only_tags.append(dict(name='h1', attrs={'class': 'print-title'}))
keep_only_tags.append(dict(name='div', attrs={'class': 'print-content'}))
keep_only_tags = [(dict(name='h1')),
(dict(name='div', attrs={'class': ['entry-meta','post-preview','entry-details', 'entry-content']}))]
remove_tags = []
remove_tags.append(dict(attrs={'class': ['field field-type-text field-field-story-switch', 'field field-type-filefield field-field-story-temp',
'field field-type-text field-field-story-author', 'field field-type-text field-field-story-lead-switch']}))
remove_tags = [(dict(attrs={'class': ['_ning_zone_inner','book-item site-commerc','wp-embedded-content',
'read-also','meta-date-modified updated', 'textwidget']}))]
extra_css = '''
body {font-family: verdana, arial, helvetica, geneva, sans-serif ;}
td.contentheading{font-size: large; font-weight: bold;}
'''
feeds = [
('Wszystkie', 'http://www.krytykapolityczna.pl/rss.xml')
]
def print_version(self, url):
soup = self.index_to_soup(url)
print_ico = soup.find(attrs={'class': 'print-page'})
print_uri = print_ico['href']
self.log('PRINT', print_uri)
return 'http://www.krytykapolityczna.pl/' + print_uri
def preprocess_html(self, soup):
for alink in soup.findAll('a'):
if alink.string is not None:
tstr = alink.string
alink.replaceWith(tstr)
return soup
feeds = [('Wszystkie', 'https://www.krytykapolityczna.pl/rss')]

View File

@ -6,12 +6,9 @@ class Kresy(BasicNewsRecipe):
__author__ = 'fenuks'
description = u'portal społeczności kresowej'
language = 'pl'
masthead_url = 'http://www.kresy.pl/public/img/logo.png'
cover_url = 'http://www.kresy.pl/public/img/logo.png'
oldest_article = 7
max_articles_per_feed = 100
no_stylesheets = True
keep_only_tags = [dict(id='artykul')]
remove_tags = [
dict(attrs={'class': ['twitter-share-button', 'likefbborder', 'tagi']})]
feeds = [(u'Wszystkie', u'http://www.kresy.pl/rss')]
keep_only_tags = [dict(name='div', attrs={'class': ['big-slider big-preview single-big', 'entry-content-wrapper clearfix standard-content']})]
remove_tags = [dict(attrs={'class': ['entry-footer', 'kresy_donate']})]
feeds = [(u'Wszystkie', u'https://www.kresy.pl/rss')]