48 lines
1 KiB
Go
48 lines
1 KiB
Go
package main
|
|
|
|
import (
|
|
"encoding/xml"
|
|
"fmt"
|
|
)
|
|
|
|
// Make up some data structures into which we can put our feed.
|
|
|
|
// Bookmark defines the fundamental structure of the items to be archived.
|
|
type Bookmark struct {
|
|
// Required
|
|
Title string `xml:"title"`
|
|
Link string `xml:"link"`
|
|
GUID string `xml:"guid"`
|
|
// Optional
|
|
PubDate string `xml:"pubDate"`
|
|
Comments string `xml:"comments"`
|
|
}
|
|
|
|
// Feed defines the structure of the RSS feed exported from Pocket
|
|
type Feed struct {
|
|
XMLName xml.Name `xml:"rss"`
|
|
Version string `xml:"version,attr"`
|
|
// Required
|
|
Title string `xml:"channel>title"`
|
|
Link string `xml:"channel>link"`
|
|
Description string `xml:"channel>description"`
|
|
// Optional
|
|
PubDate string `xml:"channel>pubDate"`
|
|
BookmarkList []Bookmark `xml:"channel>item"`
|
|
}
|
|
|
|
func main() {
|
|
fmt.Println("Launching Pocket Archive...")
|
|
|
|
db, err := getDB("./bookmarks.db")
|
|
if err != nil {
|
|
fmt.Println("Could not open or create db")
|
|
panic(err)
|
|
}
|
|
defer db.Close()
|
|
|
|
pullPocket(db)
|
|
|
|
fmt.Println("Pocket Archive exiting.")
|
|
|
|
}
|