Login before fetching data/web scraping | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Login before fetching data/web scraping

I have a running code for fetching html source of particular page of a website. However, i am getting public version of page. But i want that page which comes only when user is log in. Therefore, before fetching data, i am trying to login to the site and save that session so that when data will be fetched, it will get that version of html page which becomes visible only after log in. The website requires username and password for login. The login page is www.example.com/login while the target page is different. Can someone please help me to do this. I tried with some codes but none help me... https://code.sololearn.com/WGUfWIwLSgxx/?ref=app

13th Apr 2019, 5:35 PM
Payments Magnus
Payments Magnus - avatar
8 Answers
+ 1
So u need a login page with a a forward after successful login
15th Apr 2019, 2:59 PM
Lexfuturorum
Lexfuturorum - avatar
+ 1
OK I read you text again you need a login page with saves the date and activity of your user and if needed reopens that session?
15th Apr 2019, 5:37 PM
Lexfuturorum
Lexfuturorum - avatar
0
No...... I am doing web scraping....before fetching data from a website, i wanted my code to first log in, save that session and then fetch other website pages which are visible only after login.... Thanks
15th Apr 2019, 5:03 PM
Payments Magnus
Payments Magnus - avatar
0
Kind of logging...... Let me explain you..... My current code sends a request to a website to fetch html source of particular page and in return it shows html source page of requested website. However, it currenly showing public version of requested page. Therefore, i wanted to add a logging function in this code. This logging function should help me to first login to a site and then fetch site page through same session using cookies or any other thing. This will help me to fetch that part of data which is visible only after logging into a site. Thanks
15th Apr 2019, 5:37 PM
Payments Magnus
Payments Magnus - avatar
0
No brother....not login page....web scraping
15th Apr 2019, 5:41 PM
Payments Magnus
Payments Magnus - avatar
0
So you Want to forward username and password to another page From your page
15th Apr 2019, 8:04 PM
Lexfuturorum
Lexfuturorum - avatar
0
For that task you'll need to send a post request to another server but if you want to do that over Ajax your site may be detected as a pishing site and blocked.
15th Apr 2019, 8:10 PM
Lexfuturorum
Lexfuturorum - avatar
0
No problem.....before doing this, i would discuss about this topic with the target domain owner.....
16th Apr 2019, 10:12 AM
Payments Magnus
Payments Magnus - avatar