Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes

Notices

Reply
 
Thread Tools Search this Thread
Old 04-17-2020, 02:22 AM   #1
sricochet
Enthusiast
sricochet began at the beginning.
 
Posts: 25
Karma: 10
Join Date: Sep 2014
Device: Kindle Scribe
Science AAAS news recipe

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>
<!--           
 &lt;p style="padding-top: 1em; max-width:100%;text-align: center;font-weight:bold;font-size:large;color:#cf142b;"&gt;SYSTEM MAINTENANCE: This site will be unavailable from Wednesday, June 29th 9:00 AM EDT through Wednesday, June 29th at 9:30 AM EDT.&lt;/p&gt;
-->  
      </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>
                        <!-- &lt;div id="smGroup"&gt;
                            &lt;div class="address"&gt;1200 New York Ave NW, Washington, DC&lt;/div&gt;
                            &lt;div class="phone"&gt;202 326 6400&lt;/div&gt;
                        &lt;/div&gt; -->
                    </div>
                    <div class="col-sm-2">
                        <div>202 326 6400</div>
                        <!-- &lt;div class="logoFooter"&gt;&lt;a href="http://www.aaas.org" title="AAAS Home" class="logo"&gt;&lt;object type="image/svg+xml" data="/oxauth/img/logo_footer.svg" width="211" height="58"&gt;&lt;img src="/oxauth/img/logo_footer.png" alt="AAAS" width="211" height="57" /&gt;&lt;/object&gt;&lt;/a&gt;&lt;/div&gt; -->
                    </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.
sricochet is offline   Reply With Quote
Old 04-17-2020, 05:28 PM   #2
sricochet
Enthusiast
sricochet began at the beginning.
 
Posts: 25
Karma: 10
Join Date: Sep 2014
Device: Kindle Scribe
Ok, so a little more information.

I disabled javascript and tried to access the AAAS login page and it wouldn't load, so I think it's using javascript.

is there any way to login into this page using a recipe with javascript?

I think I'm way out of my league here.
sricochet is offline   Reply With Quote
Advert
Old 04-17-2020, 10:47 PM   #3
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,157
Karma: 22670164
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
with javascript logins you use the browser developer tools to see what actual requests the browser is making and re-creat those in the recipe. It's a pain, but can be done see for example the WSJ recipe.
kovidgoyal is offline   Reply With Quote
Old 04-18-2020, 01:28 AM   #4
sricochet
Enthusiast
sricochet began at the beginning.
 
Posts: 25
Karma: 10
Join Date: Sep 2014
Device: Kindle Scribe
Thanks for the reply!

Seems simple enough. Thanks for the heads up.
sricochet is offline   Reply With Quote
Old 04-18-2020, 04:13 AM   #5
sricochet
Enthusiast
sricochet began at the beginning.
 
Posts: 25
Karma: 10
Join Date: Sep 2014
Device: Kindle Scribe
You know what? I looked at the current issue and it had mathjax formulae embedded in it. I think I'm gonna stick with the pdf.

Thanks anyway.
sricochet is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PressePortal_DE Recipe - latest News and local Police News! VoHegg Recipes 3 05-16-2020 03:26 AM
recipe for EOS Wetenschap (Dutch science news website) erkfuizfeuadjfjz Recipes 0 02-19-2017 09:33 AM
Science AAAS recipe no longer seems to be working dmkaplan Recipes 5 11-01-2012 02:14 AM
Fairbanks Daily News-miner News Recipe Submission rogerx Recipes 2 08-25-2011 07:30 PM
New Fairbanks Daily News-miner News Recipe -- Need Date inclusion only rogerx Recipes 5 08-24-2011 09:12 AM


All times are GMT -4. The time now is 11:08 PM.


MobileRead.com is a privately owned, operated and funded community.