mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Handle BS API change in Le Monde recipe
This commit is contained in:
parent
5dad6c60ee
commit
6fbc6e6e04
@ -10,7 +10,6 @@ import os, zipfile, re, time
|
|||||||
from calibre.constants import preferred_encoding
|
from calibre.constants import preferred_encoding
|
||||||
|
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
|
||||||
from calibre.ptempfile import PersistentTemporaryFile
|
from calibre.ptempfile import PersistentTemporaryFile
|
||||||
|
|
||||||
|
|
||||||
@ -128,8 +127,8 @@ class LeMondeAbonne(BasicNewsRecipe):
|
|||||||
|
|
||||||
for i in range(nb_index_files):
|
for i in range(nb_index_files):
|
||||||
filename = os.path.join(path, "selection_%d.html" % (i + 1))
|
filename = os.path.join(path, "selection_%d.html" % (i + 1))
|
||||||
tmp = open(filename, 'r')
|
with open(filename, 'rb') as tmp:
|
||||||
soup = BeautifulSoup(tmp, convertEntities=BeautifulSoup.HTML_ENTITIES)
|
soup = self.index_to_soup(tmp.read())
|
||||||
title = soup.find('span').contents[0]
|
title = soup.find('span').contents[0]
|
||||||
if title == "Une":
|
if title == "Une":
|
||||||
title = "À la une"
|
title = "À la une"
|
||||||
@ -156,8 +155,8 @@ class LeMondeAbonne(BasicNewsRecipe):
|
|||||||
tmp.close()
|
tmp.close()
|
||||||
|
|
||||||
filename = os.path.join(path, "frame_gauche_%d.html" % (i + 1))
|
filename = os.path.join(path, "frame_gauche_%d.html" % (i + 1))
|
||||||
tmp = open(filename, 'r')
|
with open(filename, 'rb') as tmp:
|
||||||
soup = BeautifulSoup(tmp)
|
soup = self.index_to_soup(tmp.read())
|
||||||
articles = []
|
articles = []
|
||||||
for link in soup.findAll("a"):
|
for link in soup.findAll("a"):
|
||||||
article_file = link['href']
|
article_file = link['href']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user