This commit is contained in:
Kovid Goyal 2022-01-23 21:41:18 +05:30
commit f32f8a393b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -12,14 +12,13 @@ from calibre.ebooks.BeautifulSoup import BeautifulSoup
# This imports the version bundled with Calibre # This imports the version bundled with Calibre
import lxml import lxml
from lxml.builder import E from lxml.builder import E
respekt_url = 'http://www.respekt.cz' respekt_url = 'https://www.respekt.cz'
class respektRecipe(BasicNewsRecipe): class respektRecipe(BasicNewsRecipe):
__author__ = 'Tomáš Hnyk' __author__ = 'Tomáš Hnyk'
publisher = u'Respekt Publishing a. s.' publisher = u'Respekt Publishing a. s.'
description = u'Articles from the print edition' description = u'Articles from the print edition'
title = u'Respekt Magazine Print' title = u'Respekt Magazine Print'
encoding = 'utf-8' encoding = 'utf-8'
language = 'cs' language = 'cs'
delay = 0.001 delay = 0.001
@ -74,10 +73,10 @@ class respektRecipe(BasicNewsRecipe):
return raw_html return raw_html
def parse_index(self): def parse_index(self):
raw1 = self.index_to_soup('http://www.respekt.cz/tydenik/', raw=True) raw1 = self.index_to_soup('https://www.respekt.cz/tydenik/', raw=True)
root1 = lxml.html.fromstring(raw1) root1 = lxml.html.fromstring(raw1)
current_edition_url = root1.xpath("//div[@class='heroissue']/a")[0].items()[0][1] current_edition_url = root1.xpath("//div[@class='heroissue']/a")[0].items()[0][1]
raw2 = self.index_to_soup('http://www.respekt.cz/' + current_edition_url, raw=True) raw2 = self.index_to_soup('https://www.respekt.cz/' + current_edition_url, raw=True)
root2 = lxml.html.fromstring(raw2) root2 = lxml.html.fromstring(raw2)
self.cover_url = root2.xpath("//i[contains(@class, 'heroissue-cover')]")[0].get("data-src") self.cover_url = root2.xpath("//i[contains(@class, 'heroissue-cover')]")[0].get("data-src")
# Fetch date # Fetch date