Fix error in a handful of recipes caused by upgrade to mechanize 0.3 which returns lists instead of iterators for forms() and links()

Fixes #1698646 [Failed: Fetch news from New York Times](https://bugs.launchpad.net/calibre/+bug/1698646)
This commit is contained in:
Kovid Goyal 2017-06-18 19:48:44 +05:30
parent e3b55941c6
commit 889fc123e1
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
4 changed files with 5 additions and 5 deletions

View File

@ -86,7 +86,7 @@ class ESPN(BasicNewsRecipe):
f.write(raw)
br.open_local_file(fname)
br.form = br.forms().next()
br.form = list(br.forms())[0]
br.form.find_control(
name='username', type='text').value = self.username
br.form['password'] = self.password

View File

@ -89,7 +89,7 @@ img { background: none !important; float: none; margin: 0px; }
br = BasicNewsRecipe.get_browser(self)
if self.username is not None and self.password is not None:
br.open('https://acesso.uol.com.br/login.html')
br.form = br.forms().next()
br.form = list(br.forms())[0]
br['user'] = self.username
br['pass'] = self.password
br.submit().read()

View File

@ -51,8 +51,8 @@ class NikkeiNet_paper_subscription(BasicNewsRecipe):
br.open('http://www.nikkei.com/')
print "-------------------------open first login form-----------------------------"
try:
url = br.links(
url_regex="www.nikkei.com/etc/accounts/login").next().url
url = list(br.links(
url_regex="www.nikkei.com/etc/accounts/login"))[0].url
except StopIteration:
url = 'http://www.nikkei.com/etc/accounts/login?dps=3&pageflag=top&url=http%3A%2F%2Fwww.nikkei.com%2F'
br.open(url) # br.follow_link(link)

View File

@ -417,7 +417,7 @@ class NYTimes(BasicNewsRecipe):
br = BasicNewsRecipe.get_browser(self)
if self.username is not None and self.password is not None:
br.open('https://www.nytimes.com/auth/login')
br.form = br.forms().next()
br.form = list(br.forms())[0]
br['userid'] = self.username
br['password'] = self.password
br.submit().read()