mirror of
https://github.com/terorie/od-database-crawler.git
synced 2025-04-10 05:56:42 +00:00
Ignore FTP URLs
This commit is contained in:
parent
7fdffff58f
commit
f41198b00c
@ -33,6 +33,8 @@ var Schemes = [SchemeCount]string {
|
|||||||
"https",
|
"https",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var ErrUnknownScheme = errors.New("unknown protocol scheme")
|
||||||
|
|
||||||
// Error reports an error and the operation and URL that caused it.
|
// Error reports an error and the operation and URL that caused it.
|
||||||
type Error struct {
|
type Error struct {
|
||||||
Op string
|
Op string
|
||||||
@ -353,7 +355,7 @@ func getscheme(rawurl string) (scheme Scheme, path string, err error) {
|
|||||||
case "https":
|
case "https":
|
||||||
scheme = SchemeHTTPS
|
scheme = SchemeHTTPS
|
||||||
default:
|
default:
|
||||||
return SchemeInvalid, "", errors.New("unknown protocol scheme")
|
return SchemeInvalid, "", ErrUnknownScheme
|
||||||
}
|
}
|
||||||
|
|
||||||
path = rawurl[i+1:]
|
path = rawurl[i+1:]
|
||||||
|
5
main.go
5
main.go
@ -62,6 +62,11 @@ func cmdBase(clic *cli.Context) error {
|
|||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
t, err := FetchTask()
|
t, err := FetchTask()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if err == fasturl.ErrUnknownScheme {
|
||||||
|
// Not an error
|
||||||
|
err = nil
|
||||||
|
continue
|
||||||
|
}
|
||||||
logrus.WithError(err).
|
logrus.WithError(err).
|
||||||
Error("Failed getting new task")
|
Error("Failed getting new task")
|
||||||
time.Sleep(30 * time.Second)
|
time.Sleep(30 * time.Second)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user