mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
772d285326
commit
27bf2b8b63
@ -120,8 +120,7 @@ class Mediapart(BasicNewsRecipe):
|
||||
date_arr = date_str.lower().split()
|
||||
return date(day=int(date_arr[0]),
|
||||
year=int(date_arr[2]),
|
||||
month=
|
||||
[None, 'janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet',
|
||||
month=[None, 'janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet',
|
||||
'août', 'septembre', 'octobre', 'novembre', 'décembre'].index(date_arr[1]))
|
||||
|
||||
def print_version(self, url):
|
||||
@ -145,10 +144,10 @@ class Mediapart(BasicNewsRecipe):
|
||||
def get_browser(self):
|
||||
br = BasicNewsRecipe.get_browser(self)
|
||||
if self.username is not None and self.password is not None:
|
||||
br.open('https://www.mediapart.fr/user')
|
||||
br.open('https://www.mediapart.fr/login')
|
||||
br.select_form(nr=1)
|
||||
br['name'] = self.username
|
||||
br['pass'] = self.password
|
||||
br['password'] = self.password
|
||||
br.submit()
|
||||
return br
|
||||
|
||||
@ -157,16 +156,6 @@ class Mediapart(BasicNewsRecipe):
|
||||
preprocess_regexps = [
|
||||
(re.compile(r'(<body.*?>)(.*)</body>', re.IGNORECASE|re.DOTALL),
|
||||
lambda match:
|
||||
match.group(1)
|
||||
+ re.sub(re.compile(r'</?body>', re.IGNORECASE|re.DOTALL),'',
|
||||
match.group(2))
|
||||
+ '</body>')
|
||||
match.group(1) + re.sub(
|
||||
re.compile(r'</?body>', re.IGNORECASE|re.DOTALL),'', match.group(2)) + '</body>')
|
||||
]
|
||||
|
||||
# def preprocess_html(self, soup):
|
||||
# for title in soup.findAll('p', {'class':'titre_page'}):
|
||||
# title.name = 'h3'
|
||||
# for legend in soup.findAll('span', {'class':'legend'}):
|
||||
# legend.insert(0, Tag(soup, 'br', []))
|
||||
# legend.name = 'em'
|
||||
# return soup
|
||||
|
Loading…
x
Reference in New Issue
Block a user