Skip to content
Advertisement

Is there any way to get the cookies and cache of a visited website from chrome to beautifulsoup in Python?

I want to scrape a certain website weather data but the default page layout gives max of 40 results but when layout changed to simple list gives 100 results and the layout is set to default which is difficult to achieve with selenium. Is there any way to get the cookies saved in chrome to be used with beautiful soup.

JavaScript

Advertisement

Answer

Try:

JavaScript

This code use the browsers cookies in the requests module in as Session. Simply change sitename to the site you want cookies from.

Your new code:

JavaScript

prints:

JavaScript

and so on to 100…

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement