mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
commit
b36d1704e4
@ -1,52 +0,0 @@
|
||||
#!/usr/bin/env python2
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = u'Łukasz Grąbczewski 2011'
|
||||
__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 biweekly(BasicNewsRecipe):
|
||||
__author__ = u'Łukasz Grąbczewski'
|
||||
title = 'Biweekly'
|
||||
language = 'en_PL'
|
||||
publisher = 'National Audiovisual Institute'
|
||||
publication_type = 'magazine'
|
||||
description = u'link with culture [English edition of Polish magazine]: literature, theatre, film, art, music, views, talks'
|
||||
|
||||
conversion_options = {
|
||||
'authors': 'Biweekly.pl', 'publisher': publisher, 'language': language, 'comments': description, 'no_default_epub_cover': True, 'preserve_cover_aspect_ratio': True # noqa
|
||||
}
|
||||
|
||||
def build_index(self):
|
||||
browser = self.get_browser()
|
||||
browser.open('http://www.biweekly.pl/')
|
||||
|
||||
# find the link
|
||||
epublink = browser.find_link(text_regex=re.compile('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
|
Binary file not shown.
Before Width: | Height: | Size: 355 B |
Binary file not shown.
Before Width: | Height: | Size: 634 B |
@ -13,5 +13,5 @@ class Lomza(BasicNewsRecipe):
|
||||
max_articles_per_feed = 100
|
||||
remove_tags = [
|
||||
dict(name='div', attrs={'class': ['bxbanner', 'drukuj', 'wyslijznajomemu']})]
|
||||
keep_only_tags = [dict(name='div', attrs={'class': 'wiadomosc'})]
|
||||
keep_only_tags = [dict(name='div', attrs={'id': 'srodek'})]
|
||||
feeds = [(u'Łomża', u'http://feeds.feedburner.com/4lomza.pl')]
|
||||
|
@ -1,30 +0,0 @@
|
||||
import re
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
|
||||
|
||||
class Overclock_pl(BasicNewsRecipe):
|
||||
title = u'Overclock.pl'
|
||||
oldest_article = 7
|
||||
max_articles_per_feed = 100
|
||||
__author__ = 'fenuks'
|
||||
description = u'Vortal poświęcony tematyce hardware, kładący największy nacisk na podkręcanie / overclocking (włącznie z extreme) i chłodzenie / cooling (air cooling, water cooling, freon cooling, dry ice, liquid nitrogen).' # noqa
|
||||
category = 'IT'
|
||||
language = 'pl'
|
||||
masthead_url = 'http://www.overclock.pl/gfx/logo_m.png'
|
||||
cover_url = 'http://www.overclock.pl/gfx/logo_m.png'
|
||||
no_stylesheets = True
|
||||
remove_empty_feeds = True
|
||||
preprocess_regexps = [(re.compile(ur'<b>Komentarze do aktualności:.*?</a>', re.DOTALL),
|
||||
lambda match: ''), (re.compile(ur'<h3>Nawigacja</h3>', re.DOTALL), lambda match: '')]
|
||||
keep_only_tags = [
|
||||
dict(name='div', attrs={'class': 'news'}), dict(id='articleContent')]
|
||||
remove_tags = [dict(name='span', attrs={'class': 'info'}), dict(
|
||||
attrs={'class': 'shareit'})]
|
||||
feeds = [(u'Aktualno\u015bci', u'http://www.overclock.pl/rss.news.xml'),
|
||||
(u'Testy i recenzje', u'http://www.overclock.pl/rss.articles.xml')]
|
||||
|
||||
def print_version(self, url):
|
||||
if 'articles/show' in url:
|
||||
return url.replace('show', 'showall')
|
||||
else:
|
||||
return url
|
Loading…
x
Reference in New Issue
Block a user