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()
|
date_arr = date_str.lower().split()
|
||||||
return date(day=int(date_arr[0]),
|
return date(day=int(date_arr[0]),
|
||||||
year=int(date_arr[2]),
|
year=int(date_arr[2]),
|
||||||
month=
|
month=[None, 'janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet',
|
||||||
[None, 'janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet',
|
|
||||||
'août', 'septembre', 'octobre', 'novembre', 'décembre'].index(date_arr[1]))
|
'août', 'septembre', 'octobre', 'novembre', 'décembre'].index(date_arr[1]))
|
||||||
|
|
||||||
def print_version(self, url):
|
def print_version(self, url):
|
||||||
@ -145,10 +144,10 @@ class Mediapart(BasicNewsRecipe):
|
|||||||
def get_browser(self):
|
def get_browser(self):
|
||||||
br = BasicNewsRecipe.get_browser(self)
|
br = BasicNewsRecipe.get_browser(self)
|
||||||
if self.username is not None and self.password is not None:
|
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.select_form(nr=1)
|
||||||
br['name'] = self.username
|
br['name'] = self.username
|
||||||
br['pass'] = self.password
|
br['password'] = self.password
|
||||||
br.submit()
|
br.submit()
|
||||||
return br
|
return br
|
||||||
|
|
||||||
@ -157,16 +156,6 @@ class Mediapart(BasicNewsRecipe):
|
|||||||
preprocess_regexps = [
|
preprocess_regexps = [
|
||||||
(re.compile(r'(<body.*?>)(.*)</body>', re.IGNORECASE|re.DOTALL),
|
(re.compile(r'(<body.*?>)(.*)</body>', re.IGNORECASE|re.DOTALL),
|
||||||
lambda match:
|
lambda match:
|
||||||
match.group(1)
|
match.group(1) + re.sub(
|
||||||
+ re.sub(re.compile(r'</?body>', re.IGNORECASE|re.DOTALL),'',
|
re.compile(r'</?body>', re.IGNORECASE|re.DOTALL),'', match.group(2)) + '</body>')
|
||||||
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