'Logging in to Spiegel.de with Pyhon and Mechanize
Im attempting to login to Spiegel.de with my personal Logindata and retrieve a website behind the paywall. I believe the login works as the forms are correct but any retrieved website throws please pay strings at the end, the rest of the response is just mountains of javascript.
The string "recaptcha" shows up in the login website html but not in the response html to the article behind the paywall. What is wrong with this code ?
import mechanize
import http.cookiejar as cookielib
Spon_Name = 'LEGITMAIL'
Spon_Pw = 'LEGITPW'
cj = cookielib.CookieJar()
br = mechanize.Browser()
br.set_handle_robots(False)
br.set_cookiejar(cj)
br.addheaders = [('user-agent', ' Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.3) Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3'), ('accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8')]
br.open("https://gruppenkonto.spiegel.de/anmelden.html?targetUrl=https%3A%2F%2Fwww.spiegel.de%2Ffuermich%2F&requestAccessToken=true")
br.form['loginform:loginname'] = Spon_Name
br.form['loginform:password'] = Spon_Pw
br.submit()
response = br.response().read()
print(response)
print(getwebsite('Some Website behind paywall'))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
