-
-
Save zoutepopcorn/98d0244e358d5eb5c9f3b63776a5a398 to your computer and use it in GitHub Desktop.
Web scraping with Dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:http/http.dart' as http; | |
import 'package:html/parser.dart' as parser; | |
import 'package:html/dom.dart'; | |
main() async { | |
http.Response response = await http.get('https://news.ycombinator.com/'); | |
Document document = parser.parse(response.body); | |
document.getElementsByTagName('a').forEach((Element element){ | |
print(element.text); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment