vendredi 7 avril 2017

Scrape a web page that uses ember-simple-auth?

I'm trying to scrape a web page that uses ember-simple-auth. I can't figure out how to authenticate.

After I log in, I look at my browser's cookies and see ember_simple_auth:session, which is (decoding 7B%22 and the like):

u'{"authenticated":{"authenticator":"authenticator:oauth2","access_token":"1234","token_type":"bearer","user_id":5678}}

There are also cookies for ember_simple_auth:session:expiration_time and usageProfileRole-9876.

I'm using Python's requests library, but something simple doesn't work:

cookie = {'ember_simple_auth:session':[from above]}
page = requests.post('https://website.com', cookies=cookie).content

I also tried including the session:expiration and usageProfile cookies. I tried both encoded and decoded versions of the cookie values.

All the examples I can find are from the server side. How can I authenticate so that I can scrape a page from the site?




Aucun commentaire:

Enregistrer un commentaire