Code Monkey home page Code Monkey logo

Comments (4)

fefit avatar fefit commented on August 15, 2024 1

@mdrokz sorry for the late reply, this crate does not support xpath selectors. If this requirement is common, I plan to take the time to add this feature recently.

from visdom.

mdrokz avatar mdrokz commented on August 15, 2024 1

@mdrokz I have added a new feature branch to support xpath selectors. The query methods in this crate used to only accept the type &str as a selector parameter, so i add a new trait TryIntoSelector to allowed more types that implement the trait as a selector too. However, the whole logic of query methods is based on css selectors, it is not easy to add the processing logic of xpath selector. I think a simple but not so efficient way is to convert the xpath selectors into the corresponding css selectors, a small number of xpath selectors may not have corresponding css selectors, this may require expanding the capabilities of css selectors. It will takes a lot of work to fully support xpath selectors, if you have a better solution, we can discuss it here.

Thank you very much for your willingness to contribute code to this crate. You can fork the repo, and checkout a new branch from the feature branch, add code to support xpath selectors and also some unit tests code, then make a PR.

I'm worried that it may take up a lot of your time to implement this feature. If you don't have much time on this, you can also tell me, i can do some of the work together. Thanks again!

Hey @fefit thank you for taking your time to work on this feature, i will fork the project and checkout the branch when i get some time im currently working a full time job so i will be doing this on my spare time i will let you know if i encounter any issues or need your help once i see the branch. Thanks!

from visdom.

mdrokz avatar mdrokz commented on August 15, 2024

@mdrokz sorry for the late reply, this crate does not support xpath selectors. If this requirement is common, I plan to take the time to add this feature recently.

Hey thanks for the reply it will be really helpful to scrape websites that have randomly generated class names and ID. I can help out in implementing the feature If you can guide me thanks.

from visdom.

fefit avatar fefit commented on August 15, 2024

@mdrokz I have added a new feature branch to support xpath selectors. The query methods in this crate used to only accept the type &str as a selector parameter, so i add a new trait TryIntoSelector to allowed more types that implement the trait as a selector too. However, the whole logic of query methods is based on css selectors, it is not easy to add the processing logic of xpath selector. I think a simple but not so efficient way is to convert the xpath selectors into the corresponding css selectors, a small number of xpath selectors may not have corresponding css selectors, this may require expanding the capabilities of css selectors. It will takes a lot of work to fully support xpath selectors, if you have a better solution, we can discuss it here.

Thank you very much for your willingness to contribute code to this crate. You can fork the repo, and checkout a new branch from the feature branch, add code to support xpath selectors and also some unit tests code, then make a PR.

I'm worried that it may take up a lot of your time to implement this feature. If you don't have much time on this, you can also tell me, i can do some of the work together. Thanks again!

from visdom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.