The Science AAAS news recipe is not current with the AAAS science magazine website. I think I'll give it a try, but I'm new at this recipe stuff, and I've run into some trouble.
The new AAAS login procedure is to click Log In here:
https://www.sciencemag.org/, then click on one of several links (the one I use is the general AAAS login page, there are other logins for Institutional access). When you click the AAAS member link it takes you here:
https://signin.aaas.org/oxauth/login
The code is here:
Code:
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://jboss.com/products/seam/taglib">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>oxAuth - Login</title>
<link href="//cloud.webtype.com/css/0d2390c1-3843-46e7-ac6d-64d282ed73a7.css" rel="stylesheet" type="text/css" />
<link type="text/css" rel="stylesheet" href="/oxauth/stylesheet/bootstrap.min.css" />
<link type="text/css" rel="stylesheet" href="/oxauth/stylesheet/theme.css" />
</head>
<body>
<div id="topCall">
<div class="container">
<div class="row">
<div class="col-xs-12 text-left">
<a href="http://www.aaas.org" title="AAAS Home" class="logo logo--aaas"><object type="image/svg+xml" height="58" width="211" data="/oxauth/img/logo_footer.svg"><img src="/oxauth/img/logo_footer.png" height="57" width="211" alt="AAAS" /></object></a>
<a href="http://sciencemag.org" title="Science Magazine" class="logo">
<object type="image/svg+xml" height="58" width="211" data="/oxauth/img/logo-science.svg"><img src="/oxauth/img/logo-science.png" height="58" width="211" alt="Science" /></object>
</a>
</div>
</div>
</div>
</div>
<div class="body">
<div class="container"><div class="row"><div id="messages"></div>
</div></div>
<div class="container">
<form id="loginForm" name="loginForm" method="post" action="/oxauth/login" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="loginForm" value="loginForm" />
<s:token></s:token>
<div class="login-panel">
<div class="login-panel-body">
<div class="row"><div class="col-sm-12 col-md-10 col-lg-8">
<div class="dialog">
<div class="form-group" style="margin-top:25px;"><label for="loginForm:username">AAAS ID (email address)</label><input id="loginForm:username" type="text" name="loginForm:username" autocomplete="off" class="form-control" />
</div>
<div class="form-group"><label for="loginForm:password">Password</label><input id="loginForm:password" type="password" name="loginForm:password" autocomplete="off" value="" class="form-control" />
</div>
</div>
<div class="actionButtons">
<div class="row">
<div class="col-xs-12 col-sm-6"><input id="loginForm:loginButton" type="submit" name="loginForm:loginButton" value="Login" class="btn btn-primary" />
<s:div id="registerId" style="display: none;"><input id="loginForm:registerButton" type="submit" name="loginForm:registerButton" value="Register" />
</s:div>
</div>
<div class="col-xs-12 col-sm-6">
<p class="hidden-sm hidden-md hidden-lg"> </p>
<p>
<a href="https://account.aaas.org/Identity/Lookup">Don't have a AAAS ID yet?</a><br />
<a href="https://account.aaas.org/Password/Reset">Forgot password?</a>
</p>
</div>
</div>
</div>
</div></div>
</div>
</div><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="JPoRbQr0adgphOSW/aLfPB5a2Ht1Is7M2pFCBBV6Z0jKxKyPJTfR2ZY9qyATaeK2KZHaczkE3ojx7wbaimDMVjOrzgHZ2tTxyxQM8j7uo7ri/oGdI0JIoEniDMmlBPKS5qDSUGPnwpNSSTaW3i9anb7M+hO5biFydd2unstKvbwnBW2q1mo+N1lXMQSFdskgFHmCOTVhSa0LYcZT5aF3+KIRdbcvJawcPFTTdcr8YM9ZUCrAze5wcGLA+sDkhkCzC/1IOyvtmuPgKGDsZKrchxvSfT5qbJEfXkp+9Pck5ReMr7N6ctf+Efp6v3e6XsWbu4Hp3AKRDHDZcRvYcpRj3zLHdpD1nQdXwvpzGtll0a9Ns/mzPDia0JovXOgnSAHSoDeRTnSNO1q8z+9bXAEKQg==" autocomplete="off" />
</form>
<!--
<p style="padding-top: 1em; max-width:100%;text-align: center;font-weight:bold;font-size:large;color:#cf142b;">SYSTEM MAINTENANCE: This site will be unavailable from Wednesday, June 29th 9:00 AM EDT through Wednesday, June 29th at 9:30 AM EDT.</p>
-->
</div>
<script type="text/javascript">
window.onload = function() {
document.getElementById("loginForm:username").focus();
var displayRegister = false;
if (displayRegister) {
document.getElementById("loginForm:registerId").style.display = 'inline';
}
};
</script>
</div>
<s:fragment>
<footer class="footer">
<div class="container">
<div class="row">
<div class="col-sm-6">
<div class="copyright">© 2019 American Association for the Advancement of Science</div>
</div>
<div class="col-sm-4">
<div>1200 New York Ave NW, Washington, DC</div>
<!-- <div id="smGroup">
<div class="address">1200 New York Ave NW, Washington, DC</div>
<div class="phone">202 326 6400</div>
</div> -->
</div>
<div class="col-sm-2">
<div>202 326 6400</div>
<!-- <div class="logoFooter"><a href="http://www.aaas.org" title="AAAS Home" class="logo"><object type="image/svg+xml" data="/oxauth/img/logo_footer.svg" width="211" height="58"><img src="/oxauth/img/logo_footer.png" alt="AAAS" width="211" height="57" /></object></a></div> -->
</div>
</div>
</div>
</footer>
</s:fragment>
</body>
</html>
Now the part of the recipe that's got me stuck is the following:
Code:
def get_browser(self):
br = BasicNewsRecipe.get_browser(self)
if self.username is not None and self.password is not None:
br.open('https://signin.aaas.org/oxauth/login')
br.select_form(nr=0)
br['loginForm:username'] = self.username
br['loginForm:password'] = self.password
br.submit()
return br
I get an error:
File "site-packages/mechanize/_mechanize.py", line 668, in select_form
mechanize._mechanize.FormNotFoundError: no form matching nr 0
I've tried entering 1, 2, and 0 for nr, and that didn't work, same error, so I think this page has either no form, or it's a different form that's not obvious.
I've tried name="loginForm", id="loginForm" with br.select_form(nr=0), but to no avail.
This is really frustrating, and I'm not sure what to look for. If I try the recipe without login credentials, I get the titles of the articles and a link to the article, but no content.
Any help would be much appreciated.
Thanks.