Extract cookies from your web browser

by manu

I've found this convenient function, which is part of yt-dlp the other day. It allows one to extract cookies from a browser such as Google Chrome, Mozilla Firefox or Microsoft Edge. It could be quite useful if I ever have to scrape something that requires me to login first.

from yt_dlp import cookies

cookies = cookies.extract_cookies_from_browser('edge')
cookies.save('cookies.txt')

Back to the news overview