skrapeit / skrape.it

A Kotlin-based testing/scraping/parsing library providing the ability to analyze and extract data from HTML (server & client-side rendered). It places particular emphasis on ease of use and a high level of readability by providing an intuitive DSL. It aims to be a testing lib, but can also be used to scrape websites in a convenient fashion.
https://docs.skrape.it
MIT License
805 stars 59 forks source link

[BUG] Android Sample does not run. Github html updated to remove class. #165

Open mufasa08 opened 2 years ago

mufasa08 commented 2 years ago

Describe the bug Changes to github html uses in sample android application breaks current sample.

Classes have been changed.

Code Sample

                        withClass = "follow-list"
                        li {
                            findAll {
                                map {
                                    User(
                                        name = it.h3 {
                                            withClass = "follow-list-name"
                                            findFirst { text }
                                        },
                                        imageUrl = it.img {
                                            withClass = "avatar-user"
                                            findFirst { attribute("src") }
                                        }
                                    )
                                }
                            }
                        }
                    } 

The above code no longer works.

Expected behavior Proper parsing of github page

Additional context I've created a branch and updated and would like permission to open a pull request to fix this issue. Alternatively the solution I propose is as follows.


                htmlDocument {
                    div {
                        withId = "repos"
                    ol {
                        li {
                            findAll {
                                map {
                                    User(
                                        name = it.h3 {
                                            findFirst { text }
                                        },
                                        imageUrl = it.img {
                                            withClass = "avatar-user"
                                            findFirst { attribute("src") }
                                        }
                                    )
                                }
                            }
                        }
                    }
                }
                }
            }```
christian-draeger commented 2 years ago

Cool thx a lot :) just open a PR, you are welcome :)