Handy dandy

This commit is contained in:
Aaron Fischer 2018-10-09 09:14:26 +02:00
commit 0bbd96e0ab

View file

@ -0,0 +1,38 @@
package main
import (
"gopkg.in/headzoo/surf.v1"
"os"
"flag"
)
var username = flag.String("username", "", "pinboard username")
var password = flag.String("password", "", "pinboard password")
func main() {
flag.Parse()
bow := surf.NewBrowser()
err := bow.Open("https://pinboard.in/")
if err != nil {
panic(err)
}
form, formErr := bow.Form("form[name=login]")
if formErr != nil {
panic(formErr)
}
form.Input("username", *username)
form.Input("password", *password)
if form.Submit() != nil {
panic(err);
}
err = bow.Open("https://pinboard.in/export/format:xml/")
if err != nil {
panic(err)
}
bow.Download(os.Stdout)
}