-
To preface - I'm entirely new to webscraping. I've built a basic scraper in a little over a week, capable of scraping dynamically generated (and updated) data using selenium. I've been steadily adding more and more datasources, until I ran into cloudflare's bot-protection. I've started migrating over to seleniumBase, so I can use Driver(uc=True). The issue I run into is the cookiejar. The page loads succesfully, but it loads a cookie-message that needs to be addressed before page-data is loaded. Once addressed (manually or automatically) it takes roughly five seconds to load the content, whereas opening the next page of the same website takes less than a second. Because of this reason, I want my cookies to be stored in a user-profile so that I can start my session with the cookies accepted, lowering the time it takes to scrape all data significantly. This earlier question put me on the right track. In Selenium I just used my own chrome-profile because I care less about being undetected, and more about getting the data fast. I now know I need a UC-generated profile. I tried defining a non-existant dir in my project as the u_d_d, but this would open a browser session and just sit there - not continueing to open the provided url(s). To summarize - if I have read up correctly I need a UC-compatible user_data_dir to reference a UC-compatible chromeprofile if I want to be able to save the cookies between scraping-cycles. Because I can't find any (step-by-step) instructions on how to create either the u_d_d or the chromeprofile, I've been stuck running in circles between the same posts here and over at SO. Any help would be greatly appreciated. Kind Regards |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
The Don't try to set the Profile Dir, which is different from the User Data Dir. The "Default" profile will be used automatically (it's a folder inside the User Data Dir). |
Beta Was this translation helpful? Give feedback.
The
user_data_dir
will be automatically created if you set one and it doesn't already exist.For UC Mode, make sure that UC Mode creates that directory (because one that wasn't created with UC Mode will be problematic).
Don't try to set the Profile Dir, which is different from the User Data Dir. The "Default" profile will be used automatically (it's a folder inside the User Data Dir).