Skip to content
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

How to parse subElements from a given element #71

Open
mjmon opened this issue Jan 15, 2022 · 0 comments
Open

How to parse subElements from a given element #71

mjmon opened this issue Jan 15, 2022 · 0 comments

Comments

@mjmon
Copy link

mjmon commented Jan 15, 2022

Hello and good day
I have the this webpage below on image.
I'm using web_scraper: ^0.1.4

Screen Shot 2022-01-15 at 3 52 05 PM

This is how I scrape,

    final webScraper = WebScraper('http://fightnights.com');
    if (await webScraper.loadWebPage('/upcoming-boxing-schedule')) {
      final List<Map<String, dynamic>> elements = webScraper.getElement(
        "div.container > div.row > div.col-md-8.main-col > div.unicard > ul.event-list > li",
        [],
      );

      for (final Map<String, dynamic> element in elements) {
        // get the time
        final time = element.getElementTitle("time.visible-xs > span.day");
        //get info
        final eventName = element.getElementTitle("div.info > h2.title");
      }
    }

from a given elements I want again to get the sub elements, how do I do it.
I was thinking something like this, obviously this one is wrong syntax but I want to get the sub elements from the initial result of elements

        // get the time
        final time = element.getElementTitle("time.visible-xs > span.day");
        //get info
        final eventName = element.getElementTitle("div.info > h2.title");
@mjmon mjmon changed the title How to parse from a given element tree How to parse subElements from a given element Jan 15, 2022
@mjmon mjmon changed the title How to parse subElements from a given element How to parse subElements from a given element Jan 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant