https://github.com/apgapg/flutter_scrap
Website Scraping with Dart (Flutter)
https://github.com/apgapg/flutter_scrap
dart flutter scraper scraping-websites scrapper
Last synced: 6 months ago
JSON representation
Website Scraping with Dart (Flutter)
- Host: GitHub
- URL: https://github.com/apgapg/flutter_scrap
- Owner: apgapg
- Created: 2020-07-19T08:17:35.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-19T08:54:26.000Z (about 5 years ago)
- Last Synced: 2025-04-15T20:16:31.749Z (6 months ago)
- Topics: dart, flutter, scraper, scraping-websites, scrapper
- Language: CMake
- Homepage:
- Size: 70.3 KB
- Stars: 17
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# flutter_scrap
## Website Scraping with Dart (Flutter)
```
void initChaptersTitleScrap() async {
final rawUrl =
'https://unacademy.com/course/gravitation-for-iit-jee/D5A8YSAJ';
final webScraper = WebScraper('https://unacademy.com');
final endpoint = rawUrl.replaceAll(r'https://unacademy.com', '');
if (await webScraper.loadWebPage(endpoint)) {
final titleElements = webScraper.getElement(
'div.Week__Wrapper-sc-1qeje5a-2 > a.Link__StyledAnchor-sc-1n9f3wx-0 '
'> div.ItemCard__ItemInfo-xrh60s-1 '
'> h6.H6-sc-1gn2suh-0',
[]);
print(titleElements);
final titleList = [];
titleElements.forEach((element) {
final title = element['title'];
titleList.add('$title');
});
print(titleList);
if (mounted)
setState(() {
this.titleList = titleList;
});
} else {
print('Cannot load url');
}
}
```## Read blog
[https://medium.com/@ayushpguptaapg/website-scraping-with-dart-flutter-56db60033d49?sk=8f63064bca080b548660d430c35386ef](https://medium.com/@ayushpguptaapg/website-scraping-with-dart-flutter-56db60033d49?sk=8f63064bca080b548660d430c35386ef)
## Disclaimer
Although this isn't legal for some websites but here the purpose is solely educational