mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
MiDDay by calibre Periodicals
This commit is contained in:
parent
8767957773
commit
91a75aa0c9
@ -14,6 +14,7 @@ class heiseDe(BasicNewsRecipe):
|
|||||||
description = 'Computernews from Germany'
|
description = 'Computernews from Germany'
|
||||||
__author__ = 'Oliver Niesner'
|
__author__ = 'Oliver Niesner'
|
||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
|
language = 'de'
|
||||||
timefmt = ' [%d %b %Y]'
|
timefmt = ' [%d %b %Y]'
|
||||||
max_articles_per_feed = 40
|
max_articles_per_feed = 40
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
|
@ -4,7 +4,7 @@ import re
|
|||||||
class SmeRecipe(BasicNewsRecipe):
|
class SmeRecipe(BasicNewsRecipe):
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__author__ = 'Abelturd'
|
__author__ = 'Abelturd'
|
||||||
language = 'cz'
|
language = 'cs'
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
title = u'iLiteratura.cz'
|
title = u'iLiteratura.cz'
|
||||||
|
@ -9,6 +9,7 @@ class JournalofHospitalMedicine(BasicNewsRecipe):
|
|||||||
description = 'Medical news'
|
description = 'Medical news'
|
||||||
timefmt = ' [%d %b, %Y]'
|
timefmt = ' [%d %b, %Y]'
|
||||||
needs_subscription = True
|
needs_subscription = True
|
||||||
|
language = 'en'
|
||||||
|
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
#remove_tags_before = dict(name='div', attrs={'align':'center'})
|
#remove_tags_before = dict(name='div', attrs={'align':'center'})
|
||||||
|
13
resources/recipes/midday.recipe
Normal file
13
resources/recipes/midday.recipe
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
from calibre.web.feeds.news import CalibrePeriodical
|
||||||
|
|
||||||
|
class MiDDay(CalibrePeriodical):
|
||||||
|
|
||||||
|
title = 'MiDDay'
|
||||||
|
calibre_periodicals_slug = 'midday'
|
||||||
|
|
||||||
|
description = '''Get your dose of the latest news, views and fun - from the
|
||||||
|
world of politics, sports and Bollywood to the cartoons, comics and games of
|
||||||
|
the entertainment section - India’s leading tabloid has it all. To subscribe
|
||||||
|
visit <a href="http://news.calibre-ebook.com/periodical/midday">calibre
|
||||||
|
Periodicals</a>.'''
|
||||||
|
language = 'en_IN'
|
@ -18,7 +18,7 @@ class NursingTimes(BasicNewsRecipe):
|
|||||||
encoding = 'utf-8'
|
encoding = 'utf-8'
|
||||||
publisher = 'emap'
|
publisher = 'emap'
|
||||||
category = 'news, health, nursing, UK'
|
category = 'news, health, nursing, UK'
|
||||||
language = 'en-UK'
|
language = 'en_GB'
|
||||||
needs_subscription = True
|
needs_subscription = True
|
||||||
LOGIN = 'http://www.nursingtimes.net/sign-in'
|
LOGIN = 'http://www.nursingtimes.net/sign-in'
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ class TaNea(BasicNewsRecipe):
|
|||||||
oldest_article = 1
|
oldest_article = 1
|
||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
|
language = 'el'
|
||||||
|
|
||||||
remove_tags_before = dict(name='div',attrs={'id':'print-body'})
|
remove_tags_before = dict(name='div',attrs={'id':'print-body'})
|
||||||
remove_tags_after = dict(name='div',attrs={'id':'text'})
|
remove_tags_after = dict(name='div',attrs={'id':'text'})
|
||||||
|
@ -18,6 +18,7 @@ class TelepolisNews(BasicNewsRecipe):
|
|||||||
recursion = 0
|
recursion = 0
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
encoding = "utf-8"
|
encoding = "utf-8"
|
||||||
|
language = 'de_AT'
|
||||||
|
|
||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
remove_empty_feeds = True
|
remove_empty_feeds = True
|
||||||
|
@ -13,6 +13,7 @@ class TelepolisArtikel(BasicNewsRecipe):
|
|||||||
publisher = 'Heise Zeitschriften Verlag GmbH & Co KG'
|
publisher = 'Heise Zeitschriften Verlag GmbH & Co KG'
|
||||||
category = 'news'
|
category = 'news'
|
||||||
description = 'Telepolis Artikel'
|
description = 'Telepolis Artikel'
|
||||||
|
language = 'de_AT'
|
||||||
oldest_article = 7
|
oldest_article = 7
|
||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
recursion = 0
|
recursion = 0
|
||||||
|
@ -1359,25 +1359,51 @@ class AutomaticNewsRecipe(BasicNewsRecipe):
|
|||||||
self.web2disk_options.keep_only_tags = []
|
self.web2disk_options.keep_only_tags = []
|
||||||
return BasicNewsRecipe.fetch_embedded_article(self, article, dir, f, a, num_of_feeds)
|
return BasicNewsRecipe.fetch_embedded_article(self, article, dir, f, a, num_of_feeds)
|
||||||
|
|
||||||
class DownloadedNewsRecipe(BasicNewsRecipe):
|
class LoginFailed(ValueError):
|
||||||
|
pass
|
||||||
|
|
||||||
def get_downloaded_recipe(self):
|
class CalibrePeriodical(BasicNewsRecipe):
|
||||||
'Return path on local filesystem to downloaded recipe'
|
|
||||||
raise NotImplementedError
|
#: Set this to the slug for the calibre periodical
|
||||||
|
calibre_periodicals_slug = None
|
||||||
|
|
||||||
|
LOG_IN = 'http://news.calibre-ebook.com/accounts/login'
|
||||||
|
needs_subscription = True
|
||||||
|
__author__ = 'calibre Periodicals'
|
||||||
|
|
||||||
|
def get_browser(self):
|
||||||
|
br = BasicNewsRecipe.get_browser(self)
|
||||||
|
br.open(self.LOG_IN)
|
||||||
|
br.select_form(name='login')
|
||||||
|
br['username'] = self.username
|
||||||
|
br['password'] = self.password
|
||||||
|
raw = br.submit().read()
|
||||||
|
if 'href="/my-account"' not in raw:
|
||||||
|
raise LoginFailed(
|
||||||
|
'Failed to log in, check your username and password for'
|
||||||
|
' the calibre Periodicals service.')
|
||||||
|
|
||||||
|
return br
|
||||||
|
|
||||||
def download(self):
|
def download(self):
|
||||||
|
import cStringIO
|
||||||
self.log('Fetching downloaded recipe')
|
self.log('Fetching downloaded recipe')
|
||||||
rpath = self.get_downloaded_recipe()
|
raw = self.browser.open_novisit(
|
||||||
|
'http://news.calibre-ebook.com/subscribed_files/%s/0/temp.downloaded_recipe'
|
||||||
|
% self.calibre_periodicals_slug
|
||||||
|
).read()
|
||||||
|
f = cStringIO.StringIO(raw)
|
||||||
from calibre.utils.zipfile import ZipFile
|
from calibre.utils.zipfile import ZipFile
|
||||||
zf = ZipFile(rpath)
|
zf = ZipFile(f)
|
||||||
zf.extractall()
|
zf.extractall()
|
||||||
zf.close()
|
zf.close()
|
||||||
from calibre.web.feeds.recipes import compile_recipe
|
from calibre.web.feeds.recipes import compile_recipe
|
||||||
from glob import glob
|
from glob import glob
|
||||||
try:
|
try:
|
||||||
recipe = compile_recipe(open(glob('*.downloaded_recipe')[0],
|
recipe = compile_recipe(open(glob('*.recipe')[0],
|
||||||
'rb').read())
|
'rb').read())
|
||||||
self.conversion_options = recipe.conversion_options
|
self.conversion_options = recipe.conversion_options
|
||||||
except:
|
except:
|
||||||
self.log.exception('Failed to compile downloaded recipe')
|
self.log.exception('Failed to compile downloaded recipe')
|
||||||
return os.path.abspath('index.html')
|
return os.path.abspath('index.html')
|
||||||
|
|
||||||
|
@ -5,14 +5,16 @@ __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
|||||||
Builtin recipes.
|
Builtin recipes.
|
||||||
'''
|
'''
|
||||||
import re, imp, inspect, time, os
|
import re, imp, inspect, time, os
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe, CustomIndexRecipe, AutomaticNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe, CustomIndexRecipe, \
|
||||||
|
AutomaticNewsRecipe, CalibrePeriodical
|
||||||
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
||||||
from calibre.ptempfile import PersistentTemporaryDirectory
|
from calibre.ptempfile import PersistentTemporaryDirectory
|
||||||
from calibre import __appname__, english_sort
|
from calibre import __appname__, english_sort
|
||||||
|
|
||||||
BeautifulSoup, time, english_sort
|
BeautifulSoup, time, english_sort
|
||||||
|
|
||||||
basic_recipes = (BasicNewsRecipe, AutomaticNewsRecipe, CustomIndexRecipe)
|
basic_recipes = (BasicNewsRecipe, AutomaticNewsRecipe, CustomIndexRecipe,
|
||||||
|
CalibrePeriodical)
|
||||||
_tdir = None
|
_tdir = None
|
||||||
_crep = 0
|
_crep = 0
|
||||||
def compile_recipe(src):
|
def compile_recipe(src):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user