31 lines
591 B
Go
Raw Normal View History

package scraper
import (
"path"
)
2021-08-01 15:52:04 -07:00
type ImageID int
type Image struct {
2021-08-01 15:52:04 -07:00
ID ImageID
TweetID TweetID
Filename string
RemoteURL string
LocalFilename string
IsDownloaded bool
}
func ParseAPIMedia(apiMedia APIMedia) Image {
local_filename := path.Base(apiMedia.MediaURLHttps)
return Image{
Filename: apiMedia.MediaURLHttps, // XXX filename
RemoteURL: apiMedia.MediaURLHttps,
LocalFilename: local_filename,
IsDownloaded: false,
}
}
func (img Image) FilenameWhenDownloaded() string {
return path.Base(img.Filename)
}