New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] element extraction methods like $
, el, element and elements not found
#90
Comments
I also should note that I'm using Intellij and have tried this with it.skrape:skrapeit-core:RELEASE as well as 6 alpha, 4 alpha and 4.1 alpha. |
$
, el, element and elements not found
Hey, New syntax(alpha6) Important to note: Please let me know if this worked for you. |
Hi Christian, here is the document that has the old style. Also it allws you to select between all the versions of the API except for the newer ones (6 alpha) https://docs.skrape.it/docs/dsl/extracting-data-from-websites I also found examples in the documentation of using selects.element and selects.elements but I can't find it right now. I'll look around for it. |
Ok thanks. I will update the examples soon. Thx for pointing this out. Let me know if the other (newer example in the readme) works for you :) |
Thanks for following up. The example in the readme worked (from what I remember yesterday). One of the challenges I am having is how to use the different features to scrape a little more elegently. I stumbled around the code and figured out how to use withClass and then rawCssSelector which was more powerful but I'm still not able to figure out how to iterate through dom elements (for all the elements of a list and map their hrefs to the text). One example of something I need to do is visit dom elements and grab multiple pieces of information to put into an object and store that for later. It may be easier to go through the details on slack so I messages you on the kotlinlang channel.
|
Ok cool, I will close this one for now |
related to #91 - solution that have been discussed on the Kotlin slack to extract all links including its text and href until #91 has been released:
prints: what it’s doing: :) hope this helps as an alternativ this will also work ()if you don’t like the string invokation like ".jokes-nav a" {}
both solutions are perfectly fine to use and i think just a matter of taste. the first one is using a plain css-selector and an invokes it, the second one is build the selector by using the DSL which will be more readable if you have more complex selectors (under the hood skrape{it} will make a selector string out of it again) |
Describe the bug
The documentation for extracting data from a website is out of date and does not compile.
Code Sample
import it.skrape.extract import it.skrape.selects.
$` <-- is not in the selects package and doesn't compileimport it.skrape.selects.el <-- is not in the selects package and doesn't compile
import it.skrape.skrape
data class MyScrapedData(
val userName: String,
val repositoryNames: List
)
fun main() {
val githubUserData = skrape {
url = "https://github.com/skrapeit"
}`
Expected behavior
I've tried all but the most basic examples to learn the different components of scraping. selects.element and selects.elements are also used in the examples but they don't appear to be in the code. This very well could be a problem with how I have or haven't configured intellij.
The text was updated successfully, but these errors were encountered: