pcgamedb/crawler/crawler.go

41 lines
940 B
Go
Raw Normal View History

2024-09-24 06:17:11 -04:00
package crawler
import (
2024-11-15 02:02:45 -05:00
"github.com/nitezs/pcgamedb/model"
2024-09-24 06:17:11 -04:00
"go.uber.org/zap"
)
type Crawler interface {
2024-11-14 12:29:19 -05:00
Name() string
Crawl(int) ([]*model.GameItem, error)
CrawlAll() ([]*model.GameItem, error)
2024-09-24 06:17:11 -04:00
}
type SimpleCrawler interface {
Crawler
}
type PagedCrawler interface {
Crawler
CrawlMulti([]int) ([]*model.GameItem, error)
2024-09-24 06:17:11 -04:00
GetTotalPageNum() (int, error)
}
func BuildCrawlerMap(logger *zap.Logger) map[string]Crawler {
2024-11-18 12:54:26 -05:00
ret := map[string]Crawler{
"fitgirl": NewFitGirlCrawler(logger),
"dodi": NewDODICrawler(logger),
"kaoskrew": NewKaOsKrewCrawler(logger),
"freegog": NewFreeGOGCrawler(logger),
2024-09-24 06:17:11 -04:00
"xatab": NewXatabCrawler(logger),
"onlinefix": NewOnlineFixCrawler(logger),
"steamrip": NewSteamRIPCrawler(logger),
// "armgddn": NewARMGDDNCrawler(logger),
"chovka": NewChovkaCrawler(logger),
2024-09-24 06:17:11 -04:00
// "gnarly": NewGnarlyCrawler(logger),
2024-11-18 12:54:26 -05:00
// "goggames": NewGOGGamesCrawler(logger),
2024-09-24 06:17:11 -04:00
}
2024-11-18 12:54:26 -05:00
return ret
2024-09-24 06:17:11 -04:00
}