A
A
ash2ash2021-11-27 03:20:29
Java
ash2ash, 2021-11-27 03:20:29

Manual authorization through a browser call in the code with saving the session?

No hao, comrades!

Not so long ago, I sat down to study Java and wondered if I could make shit code that would log in to the site, parse the listing with content, delete the old ones and create new ones with the previously parsed content.

According to the principle of advertisements on boards, ala demolishes the old in order to create a new and higher one, but in my case it is not a board and not advertising, it has nothing to do with commerce at all, I just give an example for understanding.

What was my disappointment when I followed the link and saw that a clumsy captcha was screwed there.

And then an idea appeared, because there is a wonderful library java.awt.Desktop; which will help me call the browser inside the program. But I have no idea if there is a way after authorization (by handles in the browser) to save the session and send requests already through the code.

And in principle, I would have scored a long time ago, big and fat, but I am tormented by the question, is it really real or am I a half-educated storyteller-amateur? Thank you for your attention, I will be glad for any help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Orkhan, 2021-11-27
@ash2ash

Good afternoon.
In principle, for educational purposes, you can run the browser through selenium in headless mode. Resolve the captcha itself through 2Captcha and similar services (integrated via API). Those. you will need to parse the page using Selenium. You can try to send requests without Selenium, for example, if they have an internal API. Actually, it depends on the site. If the content is static, then you can parse the data using jsoup. In general, you need to look at what kind of site, since some sites (servers) may have honeypots, etc. configured.
Well, as a colleague noted, cookies have an expiration date.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question