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
|
2024-11-16 00:48:48 -05:00
|
|
|
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
|
2024-11-16 00:48:48 -05:00
|
|
|
CrawlMulti([]int) ([]*model.GameItem, error)
|
2024-09-24 06:17:11 -04:00
|
|
|
GetTotalPageNum() (int, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
func BuildCrawlerMap(logger *zap.Logger) map[string]Crawler {
|
|
|
|
return map[string]Crawler{
|
|
|
|
"fitgirl": NewFitGirlCrawler(logger),
|
|
|
|
"dodi": NewDODICrawler(logger),
|
|
|
|
"kaoskrew": NewKaOsKrewCrawler(logger),
|
|
|
|
// "freegog": NewFreeGOGCrawler(logger),
|
|
|
|
"xatab": NewXatabCrawler(logger),
|
|
|
|
"onlinefix": NewOnlineFixCrawler(logger),
|
|
|
|
"steamrip": NewSteamRIPCrawler(logger),
|
|
|
|
// "armgddn": NewARMGDDNCrawler(logger),
|
2024-11-18 07:21:08 -05:00
|
|
|
// "goggames": NewGOGGamesCrawler(logger),
|
|
|
|
"chovka": NewChovkaCrawler(logger),
|
2024-09-24 06:17:11 -04:00
|
|
|
// "gnarly": NewGnarlyCrawler(logger),
|
|
|
|
}
|
|
|
|
}
|