Hi everyone, I’m writing a html page scanner that should get the id of the source element -> find it on the html page -> read its attributes and then use these attributes to find this element on other pages with slight changes in the attributes. Element schema with its attributes

In the picture in red the same element with different changes is highlighted. Need help in drawing up an algorithm to search for an element on another page using the original attributes. PS I use library Jsoup

    1 answer 1

    If the link is just so different, you can do:

    1. Search item by id (I assume you will do in AsyncTask)
    2. Create a map / model / json / anything like a key: value. Or leave it in the Element variable.
    3. We write down all known attributes (class, href, title, text) and return our map (as an option, hang up a callback on AsyncTask).
    4. We transfer our map to other pages, look for all links (Elements a)
    5. In the for loop, we loop through all our links in the loop itself, each compare the attribute in the map with the attributes of the link (if ... else if ...), if the attribute matches, write the link (again, choose a model or json or something else ).

    Well, after that we return our data, in paragraph 5 you can also compare in pairs - more text in the code = best result