pcgamedb/crawler/crawler.go

41 lines
944 B
Go
Raw Permalink Normal View History

2024-09-24 06:17:11 -04:00
package crawler
import (
2024-11-20 06:09:04 -05:00
"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{
2024-12-21 11:37:00 -05:00
"fitgirl": NewFitGirlCrawler(logger),
"dodi": NewDODICrawler(logger),
"kaoskrew": NewKaOsKrewCrawler(logger),
"freegog": NewFreeGOGCrawler(logger),
"xatab": NewXatabCrawler(logger),
"onlinefix": NewOnlineFixCrawler(logger),
"steamrip": NewSteamRIPCrawler(logger),
"chovka": NewChovkaCrawler(logger),
"goggames": NewGOGGamesCrawler(logger),
"johncena141": NewJohncena141Crawler(logger),
2024-09-24 06:17:11 -04:00
// "gnarly": NewGnarlyCrawler(logger),
}
2024-11-18 12:54:26 -05:00
return ret
2024-09-24 06:17:11 -04:00
}