remove unnecessary CBox prefix
rewrite sraper/dumper examples load should not nake a new file simply the NewScraper() funciton
This commit is contained in:
6 files changed
+80
-60
No files matched your search
+24
-16
@@ -2,37 +2,45 @@ package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
|
||||
cboxscraper "github.com/Neo-Desktop/go-cbox-scraper"
|
||||
cbox "github.com/Neo-Desktop/go-cbox-scraper"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// this example configuration is for a "new" style cbox
|
||||
// this will not work with the program as-is
|
||||
info := cboxscraper.CBoxServerInfo{
|
||||
WebHostID: 6,
|
||||
BoxID: 850801,
|
||||
BoxTag: "hD3VIj",
|
||||
Debug: false,
|
||||
if len(os.Args) != 2 {
|
||||
log.Fatalln("syntax:", os.Args[0], "[filename]")
|
||||
}
|
||||
|
||||
scraper := cboxscraper.NewScraper(info, -1, -1)
|
||||
scraper := cbox.NewScraper()
|
||||
err := scraper.Load(os.Args[1])
|
||||
|
||||
err := scraper.Load("../test.gob")
|
||||
if err != nil {
|
||||
log.Println("Load failed:", err)
|
||||
if err != nil && os.IsNotExist(err) {
|
||||
log.Println("Unable to open file, attempting to create...", err)
|
||||
scraper.Configure(cbox.ServerInfo{
|
||||
WebHostID: 7,
|
||||
BoxID: 41422,
|
||||
BoxTag: "7wcls1",
|
||||
Debug: false,
|
||||
})
|
||||
err = scraper.Save(os.Args[1])
|
||||
if err != nil {
|
||||
log.Fatalln("Unable to save file:", err)
|
||||
}
|
||||
} else if err != nil {
|
||||
log.Fatalln("Loading file failed:", err)
|
||||
}
|
||||
|
||||
err = scraper.Scrape(true)
|
||||
if err != nil {
|
||||
log.Println("Scraper failed:", err)
|
||||
log.Println("Scraping did not finish successfully: ", err)
|
||||
}
|
||||
|
||||
// change this value before saving
|
||||
// all settings and messages are saved when calling Save()
|
||||
scraper.Debug = true
|
||||
|
||||
err = scraper.Save("../test.gob")
|
||||
err = scraper.Save(os.Args[1])
|
||||
if err != nil {
|
||||
log.Println("Save failed:", err)
|
||||
log.Fatalln("Unable to save file:", err)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user