30 lines
578 B
Go
Raw Normal View History

package scraper
import (
"path"
)
type ImageID int64
2021-08-01 15:52:04 -07:00
type Image struct {
2021-08-01 15:52:04 -07:00
ID ImageID
TweetID TweetID
2021-10-10 16:06:47 -07:00
Width int
Height int
RemoteURL string
LocalFilename string
IsDownloaded bool
}
func ParseAPIMedia(apiMedia APIMedia) Image {
local_filename := path.Base(apiMedia.MediaURLHttps)
return Image{
ID: ImageID(apiMedia.ID),
RemoteURL: apiMedia.MediaURLHttps,
2021-10-10 16:06:47 -07:00
Width: apiMedia.OriginalInfo.Width,
Height: apiMedia.OriginalInfo.Height,
LocalFilename: local_filename,
IsDownloaded: false,
}
}