Ulyssedev / Rust-undetected-chromedriver

A rust implementation of ultrafunkamsterdam's undetected-chromedriver library based on thirtyfour
https://crates.io/crates/undetected-chromedriver
MIT License
39 stars 22 forks source link

Refractor and Bug Fixes. #3

Closed itehax closed 1 year ago

itehax commented 1 year ago

Hi,I will soon upload a video on youtube about web scraping using rust and I found your crate very useful,so thanks in advance for the work.

In spite of that,I noticed some things to fix,leaving out a big refractor to the code,which can be divided into smaller and coincidental functions,I removed some used imports and other little things to make the code idiomatic,making it adhere to clippy standards.

Also on windows,it was not detecting the driver for me,so I added a condition to make that happen

Also I noticed a bug that was causing the cdc_ string to be deleted(or rather overwritten),which seeing the source code is not what we want,as we want to replace the 22 characters after it. I have fixed the code so as to solve this problem,as the photos prove. Note: the bug occasionally caused me to crash the program,as the wrong part of the binary was replaced. Now this problem is no longer there.

This is the normal chromedriver.

chromedrvier

This is after your code.

This is after your code

This is after the fix :)

This is after the fix :)

itehax commented 1 year ago

there is also another bug,which is that i removed the fact that it iter all the bytes - 3,which cause the panic for reading out of bounds,that's why the actions fail. Now it should be fixed.

Ulyssedev commented 1 year ago

Hey,

Thanks a lot for the contribution! It will be merged and will be available on the next release once I'm finished with improving the automatic chromedriver fetching on Windows. I will probably add some actions to automatically lint the project using Clippy in order to have a unified style across all contributions. Thanks again!