Set up project:
mkdir project
cd project
npm init -y
# Install Gnome and some other useful thins | |
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description. | |
# And based on https://wiki.archlinux.de/title/Anleitung_f%C3%BCr_Einsteiger | |
# I have just copied commands from https://wiki.archlinux.de/title/Anleitung_f%C3%BCr_Einsteiger#Weitere_notwendige_Dienste | |
# It's just to have it with one view after doing a [fresh installation](https://gist.github.com/thacoon/05d5a39606ab554455d6713e8a714b2c) | |
# Some useful services | |
pacman -S acpid ntp dbus avahi cups cronie |
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){ |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"/> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no"/> | |
<meta name="google" content="notranslate"/> | |
<meta name="msapplication-tap-highlight" content="no"/> | |
<meta http-equiv="cache-control" content="no-store"/> | |
<meta http-equiv="expires" content="0"/> |
//npm init -y | |
//npm install --save puppeteer | |
//usage: node script.js /path/to/input.html /path/to/output.pdf | |
//script.js | |
const puppeteer = require('puppeteer'); | |
(async () => { | |