Are you looking at the headers and responses of the payloads? I'm unsure if parameter order matters, but with Python requests, you can order the headers and payload bodies.
I personally love using Fiddler in Windows to capture all the traffic and analyze it. Also, are you using sticky proxies?
For basic proxies, rotating proxies are for sessionless scraping.
Sticky proxies are for session based actions.
Hmmm, are you disabling Javascript? It is far easier to profile and fingerprint a bot when all the JS API data gives intimate details about its operating environment.Hey Jack. I don't check the headers and responses, mainly because the library I'm using (selenium in Python) handles that for me.
I do use sticky proxies and not rotating proxies because I'm going for automation, not scraping.
def visit(self, url: str) -> None:
if (self.driver.current_url != url):
self.driver.get(url)
self.long()
# blah blah blah
comments_button = self.get_element("//div[@id='siteTable']//div[@id='thing_t3_{}']//li[@class='first']", (thread_id, ))
self.click_element(comments_button)
# blah blah blah
Eureka! Got my votes to stick, but I can't be 100% certain that my final change fixed it, but it's most likely the reason. I was being pretty stupid, haha.
I think the reason my votes weren't sticking is because when I navigated to the thread comments section to either vote on the thread or comments in the thread, I would do so by fetching the the comments page via the driver.
Code:def visit(self, url: str) -> None: if (self.driver.current_url != url): self.driver.get(url) self.long()
I then implemented a new method of reaching the comments: I found the comment's button element under the thread thumbnail and had my driver click that.
Code:# blah blah blah comments_button = self.get_element("//div[@id='siteTable']//div[@id='thing_t3_{}']//li[@class='first']", (thread_id, )) self.click_element(comments_button) # blah blah blah
I believe that clicking on the comment button sets some flag on reddit's end that enables voting to stick. If you inspect the comment button element, you'll also see that it triggers some js events probably related to enabling voting. It could also, more likely, simply be that navigating to the comments page via link provides a referrer, while fetching via driver gets doesn't.
So that's probably the reason, but there are some additinal other things I did which, if you plan to write or are currently writing a scraping or automating application (not just for reddit) via selenium, you might want to do/implement/know.
1) I switched from Firefox to Chromium. THIS IS REALLY IMPORTANT. When using selenium with Firefox, Firefox imbeds some flag in the html(?). Not entirely sure, but it allows advanced detection algorithms, such as those by distill networks, to flag your browser. Chrome or go home, I guess.
2) Modified the Chromium driver. Even after using Chrome, you need to modify/recompile the driver. Why? It's because some Javascript in the driver has a certain variable that can be detected, which gives away that you are using selenium. Here is the stackoverflow link that explains this better than I can, AND provides a solution (I can't post the full link yet due to account restrictions): questions/33225947/can-a-website-detect-when-you-are-using-selenium-with-chromedriver
3) I patched all my webRTC leaks.
and finally
4) I randomized my useragent. In Python, I use the fake_useragent library. I then generate useragents that rougly match the ratios of useragents seen in the wild.
So ya, even using really young accounts (less than a week old) and shared data warehouse proxies, I'm getting my votes to stick.
Again, thanks for all the help, I appreciate it.
I'd still recommend inspecting the traffic, because you'll see the exact traffic that gets sent when you are clicking on page elements, and you can mimic the exact path.
You're doing some interesting things, so I hope you don't mind if I check back on your progress@JackTheRooster
My project at the moment is running through chrome web driver, and you're right, it is memory extensive, but I think that I will still be able to get 50-100 concurrent processes without further optimization just based on CPU and RAM usage running 10-15 simultaneous processes.
I do plan to optimize though, because the end goal is to support hundreds of users at the same time.
@GermanBotMafia
I do plan to look at network traffic, patch and leaks, and optimize further when I get the chance. Making this as efficient as possible is important to me, but I'm still working on some other parts of the program and will have to get to optimizing near the end.
Bommie, for your bot, do you use browser automation, http requests, or a combination of both? It seems more and more sites fingerprint via Javascript, and emulating a browser seems to be the best way of getting through.You don't need private proxies OR old accounts at all. My bot is specifically built to work with shitty proxies and virgin accounts. I have had no issues and it works flawlessly. I might know what your issue is but maybe not. PM me for it though.
What do you do about the fingerprint data that you have to send them? The Javascript tattles on you, and they expect this data.I wouldn't do this. Reddit doesn't include any dynamic content (like Flash) which requires any browser based emulation, no matter if headless or not.
You can do upvotes and downvotes with simple HTTPS request, like with libcurl. This will make everything harder to detect as a bot.
Eureka! Got my votes to stick, but I can't be 100% certain that my final change fixed it, but it's most likely the reason. I was being pretty stupid, haha.
I think the reason my votes weren't sticking is because when I navigated to the thread comments section to either vote on the thread or comments in the thread, I would do so by fetching the the comments page via the driver.
Code:def visit(self, url: str) -> None: if (self.driver.current_url != url): self.driver.get(url) self.long()
I then implemented a new method of reaching the comments: I found the comment's button element under the thread thumbnail and had my driver click that.
Code:# blah blah blah comments_button = self.get_element("//div[@id='siteTable']//div[@id='thing_t3_{}']//li[@class='first']", (thread_id, )) self.click_element(comments_button) # blah blah blah
I believe that clicking on the comment button sets some flag on reddit's end that enables voting to stick. If you inspect the comment button element, you'll also see that it triggers some js events probably related to enabling voting. It could also, more likely, simply be that navigating to the comments page via link provides a referrer, while fetching via driver gets doesn't.
So that's probably the reason, but there are some additinal other things I did which, if you plan to write or are currently writing a scraping or automating application (not just for reddit) via selenium, you might want to do/implement/know.
1) I switched from Firefox to Chromium. THIS IS REALLY IMPORTANT. When using selenium with Firefox, Firefox imbeds some flag in the html(?). Not entirely sure, but it allows advanced detection algorithms, such as those by distill networks, to flag your browser. Chrome or go home, I guess.
2) Modified the Chromium driver. Even after using Chrome, you need to modify/recompile the driver. Why? It's because some Javascript in the driver has a certain variable that can be detected, which gives away that you are using selenium. Here is the stackoverflow link that explains this better than I can, AND provides a solution (I can't post the full link yet due to account restrictions): questions/33225947/can-a-website-detect-when-you-are-using-selenium-with-chromedriver
3) I patched all my webRTC leaks.
and finally
4) I randomized my useragent. In Python, I use the fake_useragent library. I then generate useragents that rougly match the ratios of useragents seen in the wild.
So ya, even using really young accounts (less than a week old) and shared data warehouse proxies, I'm getting my votes to stick.
Again, thanks for all the help, I appreciate it.
preferences = {
"webrtc.ip_handling_policy" : "disable_non_proxied_udp",
"webrtc.multiple_routes_enabled": False,
"webrtc.nonproxied_udp_enabled" : False
}
chrome_options.add_experimental_option("prefs", preferences)
Btw randomize your window sizing to a sane range. That's often a first line of defense against bot fingerprinting.This is superhelpfull to me.
- When you modified your chromedriver, what did you replace ? only "cdc_" or more ?
- How did you patch webRTC leaks ? is it a chromeOptions to add ?
Could you share what options are you using to launch the driver ? I use atm :
"--disable-plugins", "--incognito", "--window-size=1920,1080", "--disable-extensions", "--disable-plugins-discovery"
Thanks