mirror of
https://github.com/kovidgoyal/calibre.git
synced 2026-04-02 23:31:59 -04:00
Update recipe for My Zeit EPUB subscription
This commit is contained in:
parent
bf047369aa
commit
7b4840f54e
@ -8,7 +8,7 @@ __docformat__ = 'restructuredtext de'
|
||||
__version__ = '1.5'
|
||||
|
||||
'''
|
||||
Die Zeit EPUB
|
||||
My Zeit EPUB
|
||||
'''
|
||||
|
||||
import io
|
||||
@ -28,15 +28,16 @@ from contextlib import closing
|
||||
|
||||
from calibre.utils.magick.draw import save_cover_data_to
|
||||
|
||||
from mechanize import Cookie
|
||||
|
||||
class ZeitEPUBAbo(BasicNewsRecipe):
|
||||
|
||||
title = u'Die Zeit'
|
||||
description = u'Das EPUB Abo der Zeit (needs subscription)'
|
||||
title = u'My Zeit'
|
||||
description = u'Das EPUB Abo der Zeit (needs subscription - use session-cookie as password)'
|
||||
language = 'de'
|
||||
lang = 'de-DE'
|
||||
|
||||
__author__ = 'Steffen Siebert, revised by Tobias Isenberg (with some code by Kovid Goyal), updated by Henning Losert'
|
||||
__author__ = 'Steffen Siebert, revised by Tobias Isenberg (with some code by Kovid Goyal), updated by Henning Losert and Fabian Schuller'
|
||||
needs_subscription = True
|
||||
|
||||
conversion_options = {
|
||||
@ -184,20 +185,25 @@ class ZeitEPUBAbo(BasicNewsRecipe):
|
||||
]
|
||||
|
||||
def build_index(self):
|
||||
url = 'https://meine.zeit.de/anmelden?url=https%3A//epaper.zeit.de/abo/diezeit'
|
||||
url = 'https://epaper.zeit.de/abo/diezeit'
|
||||
browser = self.get_browser()
|
||||
|
||||
# new login process
|
||||
c = Cookie(
|
||||
version=0,
|
||||
name='zeit_sso_201501',
|
||||
value=self.password,
|
||||
port=None, port_specified=False,
|
||||
domain='.zeit.de', domain_specified=True, domain_initial_dot=True,
|
||||
path='/', path_specified=True,
|
||||
secure=True,
|
||||
expires=None,
|
||||
discard=True,
|
||||
comment=None,
|
||||
comment_url=None,
|
||||
rest={}
|
||||
)
|
||||
browser.cookiejar.set_cookie(c)
|
||||
browser.open(url)
|
||||
browser.select_form(nr=0)
|
||||
browser.form['email'] = self.username
|
||||
browser.form['pass'] = self.password
|
||||
browser.submit()
|
||||
# change into abo section - not needed between late 2016 and May 2017, and again starting from March 2020
|
||||
# browser.open(url)
|
||||
# abolink = browser.find_link(text_regex=re.compile(
|
||||
# '.*E-Paper.*')) # used to be '.*Abo-Bereich.*'
|
||||
# browser.follow_link(abolink)
|
||||
# find page for latest issue
|
||||
latestlink = browser.find_link(text_regex=re.compile(r'.*ZUR AKTUELLEN AUSGABE.*'))
|
||||
browser.follow_link(latestlink)
|
||||
@ -248,15 +254,26 @@ class ZeitEPUBAbo(BasicNewsRecipe):
|
||||
self.log.warning('Downloading cover')
|
||||
try:
|
||||
self.log.warning('Trying PDF-based cover')
|
||||
url = 'https://meine.zeit.de/anmelden?url=https%3A//epaper.zeit.de/abo/diezeit'
|
||||
url = 'https://epaper.zeit.de/abo/diezeit'
|
||||
browser = self.get_browser()
|
||||
|
||||
# new login process
|
||||
c = Cookie(
|
||||
version=0,
|
||||
name='zeit_sso_201501',
|
||||
value=self.password,
|
||||
port=None, port_specified=False,
|
||||
domain='.zeit.de', domain_specified=True, domain_initial_dot=True,
|
||||
path='/', path_specified=True,
|
||||
secure=True,
|
||||
expires=None,
|
||||
discard=True,
|
||||
comment=None,
|
||||
comment_url=None,
|
||||
rest={}
|
||||
)
|
||||
browser.cookiejar.set_cookie(c)
|
||||
browser.open(url)
|
||||
browser.select_form(nr=0)
|
||||
browser.form['email'] = self.username
|
||||
browser.form['pass'] = self.password
|
||||
browser.submit()
|
||||
|
||||
# change into abo section - not needed at the moment
|
||||
# browser.open(url)
|
||||
# abolink = browser.find_link(text_regex=re.compile(
|
||||
@ -295,3 +312,6 @@ class ZeitEPUBAbo(BasicNewsRecipe):
|
||||
self.log.warning('Using static old low-res cover')
|
||||
cover_url = 'http://images.zeit.de/bilder/titelseiten_zeit/1946/001_001.jpg'
|
||||
return cover_url
|
||||
|
||||
|
||||
calibre_most_common_ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user