WebScraping in flutter giving empty output

Viewed 15

I'm trying to scrape a website using flutter using webScraper package...

late List<Map<String, dynamic>> top1Wall;
bool top1Loaded = false;
int page = 1;

void top1Fetch() async {
final top1Scraper = WebScraper("https://animixplay.to");

if (await top1Scraper.loadWebPage("/")) {
top1Wall = top1Scraper.getElement(
  'div#resultplace > ul.searchresult > li > a > div.searchimg > img ',
  ['src']);

// ignore: avoid_print
print(top1Wall);
setState(() {
top1Loaded = true;
});
}
}

 @override
 void initState() {
 super.initState();
 top1Fetch();
 }

here is where I use the scrapped images into my UI

 SizedBox(
              height: 250,
              child: ListView(
                scrollDirection: Axis.horizontal,
                children: [
                  for (int i = 0; i < top1Wall.length; i++)
                    Padding(
                      padding: const EdgeInsets.all(8.0),
                      child: ClipRRect(
                        borderRadius: BorderRadius.circular(20.0),
                        child: CachedNetworkImage(
                          imageUrl: top1Wall[i]['attributes']['src'],
                          fit: BoxFit.cover,
                        ),
                      ),
                    ),
                  const SizedBox(height: 10),
                  const Padding(padding: EdgeInsets.only(left: 25))
                ],
              ),
            ),

Here, this URL https://animixplay.to is scrapped properly and Images are fetched but when I use the URL from the same website https://animixplay.to/?genre=any&orderby=popular it doesn't scrape and there are many more websites like zoro.to that doesn't gets scraped

0 Answers
Related