Handy dandy
This commit is contained in:
commit
0bbd96e0ab
1 changed files with 38 additions and 0 deletions
38
src/aaron-fischer.net/fupin/main.go
Normal file
38
src/aaron-fischer.net/fupin/main.go
Normal 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)
|
||||||
|
}
|
Loading…
Reference in a new issue