mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Set Cover Url
Fix Login (httperror_seek_wrapper: HTTP Error 404: Not Found)
This commit is contained in:
parent
ea222f75be
commit
54553d8a21
@ -4,6 +4,7 @@ __copyright__ = '2012, 2013 Andreas Zeiser <andreas.zeiser@web.de>'
|
|||||||
szmobil.sueddeutsche.de/
|
szmobil.sueddeutsche.de/
|
||||||
'''
|
'''
|
||||||
# History
|
# History
|
||||||
|
# 2014.12.18 Fixing URL set Cover by lala-rob (web@lala-rob.de)
|
||||||
# 2014.10.06 Fixing Login URL and Article URL by lala-rob (web@lala-rob.de)
|
# 2014.10.06 Fixing Login URL and Article URL by lala-rob (web@lala-rob.de)
|
||||||
#
|
#
|
||||||
# 2013.01.09 Fixed bugs in article titles containing "strong" and
|
# 2013.01.09 Fixed bugs in article titles containing "strong" and
|
||||||
@ -19,17 +20,17 @@ class SZmobil(BasicNewsRecipe):
|
|||||||
__author__ = u'Andreas Zeiser'
|
__author__ = u'Andreas Zeiser'
|
||||||
description = u'Nachrichten aus Deutschland. Zugriff auf kostenpflichtiges Abo SZ mobil.'
|
description = u'Nachrichten aus Deutschland. Zugriff auf kostenpflichtiges Abo SZ mobil.'
|
||||||
publisher = u'Sueddeutsche Zeitung'
|
publisher = u'Sueddeutsche Zeitung'
|
||||||
|
masthead_url = 'http://pix.sueddeutsche.de/img/layout/header/SZ_solo288x31.gif'
|
||||||
language = u'de'
|
language = u'de'
|
||||||
publication_type = u'newspaper'
|
publication_type = u'newspaper'
|
||||||
category = u'news, politics, Germany'
|
category = u'news, politics, Germany'
|
||||||
|
cover_url = 'http://upload.wikimedia.org/wikipedia/commons/d/d3/Suddeutsche_Zeitung_090520_M.jpg'
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
oldest_article = 2
|
oldest_article = 2
|
||||||
encoding = 'iso-8859-1'
|
encoding = 'iso-8859-1'
|
||||||
needs_subscription = True
|
needs_subscription = True
|
||||||
remove_empty_feeds = True
|
remove_empty_feeds = True
|
||||||
delay = 1
|
delay = 1
|
||||||
cover_source = 'http://www.sueddeutsche.de/verlag'
|
|
||||||
|
|
||||||
# if you want to get rid of the date on the title page use
|
# if you want to get rid of the date on the title page use
|
||||||
# timefmt = ''
|
# timefmt = ''
|
||||||
@ -38,25 +39,17 @@ class SZmobil(BasicNewsRecipe):
|
|||||||
root_url ='http://epaper.sueddeutsche.de/app/service/epaper-mobil/'
|
root_url ='http://epaper.sueddeutsche.de/app/service/epaper-mobil/'
|
||||||
keep_only_tags = [dict(name='div', attrs={'class':'article'})]
|
keep_only_tags = [dict(name='div', attrs={'class':'article'})]
|
||||||
|
|
||||||
def get_cover_url(self):
|
|
||||||
src = self.index_to_soup(self.cover_source)
|
|
||||||
image_url = src.find(attrs={'class':'preview-image'})
|
|
||||||
return image_url.div.img['src']
|
|
||||||
|
|
||||||
def get_browser(self):
|
def get_browser(self):
|
||||||
browser = BasicNewsRecipe.get_browser(self)
|
browser = BasicNewsRecipe.get_browser(self)
|
||||||
|
|
||||||
# Login via fetching of Streiflicht -> Fill out login request
|
# Login via fetching of Streiflicht -> Fill out login request
|
||||||
url = 'https://id.sueddeutsche.de/login'
|
url = 'https://id.sueddeutsche.de/login'
|
||||||
url2 = 'https://id.sueddeutsche.de/login/ticket?redirect_uri=http%3A%2F%2Fepaper.sueddeutsche.de%2Fapp%2Fservice%2Fepaper-mobil%2Flanding.php%3Fid%3Dstreif%26etag%3D1&service_id=epapermobile'
|
|
||||||
browser.open(url)
|
browser.open(url)
|
||||||
|
|
||||||
browser.select_form(nr=0) # to select the first form
|
browser.select_form(nr=0) # to select the first form
|
||||||
browser['login'] = self.username
|
browser['login'] = self.username
|
||||||
browser['password'] = self.password
|
browser['password'] = self.password
|
||||||
browser.submit()
|
browser.submit()
|
||||||
browser.open(url2)
|
|
||||||
|
|
||||||
return browser
|
return browser
|
||||||
|
|
||||||
def parse_index(self):
|
def parse_index(self):
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
|
__copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
'''
|
'''
|
||||||
www.sueddeutsche.de/sz/
|
www.sueddeutsche.de/sz/
|
||||||
'''
|
'''
|
||||||
# History
|
# History
|
||||||
# 2014.10.02 Fixed url Problem von lala-rob(web@lala-rob.de)
|
# 2014.12.15 Set Cover by lala-rob(web@lala-rob.de)
|
||||||
|
# 2014.10.02 Fixed url Problem by lala-rob(web@lala-rob.de)
|
||||||
|
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
from calibre import strftime
|
from calibre import strftime
|
||||||
@ -22,7 +22,7 @@ class SueddeutcheZeitung(BasicNewsRecipe):
|
|||||||
needs_subscription = True
|
needs_subscription = True
|
||||||
remove_empty_feeds = True
|
remove_empty_feeds = True
|
||||||
delay = 1
|
delay = 1
|
||||||
cover_source = 'http://www.sueddeutsche.de/verlag'
|
cover_url = 'http://upload.wikimedia.org/wikipedia/commons/d/d3/Suddeutsche_Zeitung_090520_M.jpg'
|
||||||
PREFIX = 'http://epaper.sueddeutsche.de'
|
PREFIX = 'http://epaper.sueddeutsche.de'
|
||||||
INDEX = PREFIX + '/app/epaper/textversion/'
|
INDEX = PREFIX + '/app/epaper/textversion/'
|
||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
@ -94,11 +94,6 @@ class SueddeutcheZeitung(BasicNewsRecipe):
|
|||||||
,(u'Beilage' , INDEX + 'Beilage/' )
|
,(u'Beilage' , INDEX + 'Beilage/' )
|
||||||
]
|
]
|
||||||
|
|
||||||
def get_cover_url(self):
|
|
||||||
cover_source_soup = self.index_to_soup(self.cover_source)
|
|
||||||
preview_image_div = cover_source_soup.find(attrs={'class':'preview-image'})
|
|
||||||
return preview_image_div.div.img['src']
|
|
||||||
|
|
||||||
def parse_index(self):
|
def parse_index(self):
|
||||||
src = self.index_to_soup(self.INDEX)
|
src = self.index_to_soup(self.INDEX)
|
||||||
id = ''
|
id = ''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user