Skip to content
This repository has been archived by the owner on Apr 11, 2018. It is now read-only.

Commit

Permalink
Move crawler into the main package
Browse files Browse the repository at this point in the history
  • Loading branch information
morphar committed Aug 7, 2016
1 parent c6cb9d6 commit 487973a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
7 changes: 2 additions & 5 deletions minicrawler/minicrawler.go → crawler.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// minicrawler is a super simple crawler.
// It's basically a wrapper around http.Client to make some things easier
// It's sole purpose is to do the fetching in Picture Life Rescuer.
package minicrawler
package main

import (
"fmt"
Expand All @@ -23,7 +20,7 @@ type Crawler struct {
UserAgent string
}

func New() Crawler {
func NewCrawler() Crawler {
jar, _ := cookiejar.New(nil)
return Crawler{
Client: http.Client{Jar: jar},
Expand Down
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Rescue as much as possible from your Picturelife account
package main

import (
Expand All @@ -17,7 +18,6 @@ import (
"golang.org/x/crypto/ssh/terminal"

"github.com/cheggaaa/pb"
"github.com/morphar/rescuelife/minicrawler"
)

type Media struct {
Expand Down Expand Up @@ -126,7 +126,7 @@ func main() {
}

// Instantiate the crawler
client := minicrawler.New()
client := NewCrawler()

// Ask for email and password
signinValues := getCredentials()
Expand Down Expand Up @@ -330,7 +330,7 @@ func main() {
fmt.Println("\tFailed: ", fails)
}

func fetchMedia(client *minicrawler.Crawler, media *Media) {
func fetchMedia(client *Crawler, media *Media) {
media.Retries += 1
media.Status = "started"

Expand Down

0 comments on commit 487973a

Please sign in to comment.