govd/models/ext.go
stefanodvx 3e351e7e43 use host matching instead of regex (desc)
why? using regex on every single message the bot receives, even simple patterns, can be very harmful for your cpu lol
2025-04-16 14:11:55 +02:00

35 lines
630 B
Go

package models
import (
"govd/enums"
"regexp"
)
type Extractor struct {
Name string
CodeName string
Type enums.ExtractorType
Category enums.ExtractorCategory
URLPattern *regexp.Regexp
Host []string
IsDRM bool
IsRedirect bool
Run func(*DownloadContext) (*ExtractorResponse, error)
}
type ExtractorResponse struct {
MediaList []*Media
URL string // redirected URL
}
func (extractor *Extractor) NewMedia(
contentID string,
contentURL string,
) *Media {
return &Media{
ContentID: contentID,
ContentURL: contentURL,
ExtractorCodeName: extractor.CodeName,
}
}