You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

105 lines
2.7 KiB

package main
type Config struct {
ClientId string `json:"client_id"`
ClientSecret string `json:"client_secret"`
type Data struct {
AuthorizationHeader string `json:"authorization_header"`
AuthorizationExpiry int64 `json:"authorization_expiry"`
type TokenResponse struct {
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
ExpiresIn int64 `json:"expires_in"`
type RedditVideo struct {
HlsUrl string `json:"hls_url"`
DashUrl string `json:"dash_url"`
FallbackUrl string `json:"fallback_url"`
type SecureMedia struct {
RedditVideo *RedditVideo `json:"reddit_video"`
type GalleryDataItem struct {
Id int `json:"id"`
MediaId string `json:"media_id"`
type GalleryData struct {
Items []GalleryDataItem `json:"items"`
func (s GalleryData) Len() int {
return len(s.Items)
func (s GalleryData) Swap(i, j int) {
s.Items[i], s.Items[j] = s.Items[j], s.Items[i]
func (s GalleryData) Less(i, j int) bool {
return s.Items[i].Id < s.Items[j].Id
// despite the name, it is not several items, but one
// ???
type MediaMetadataItemS struct {
U string `json:"u"`
Mp4 string `json:"mp4"`
Gif string `json:"gif"`
type MediaMetadataItem struct {
Status string `json:"status"`
S *MediaMetadataItemS `json:"s"`
type PreviewSource struct {
Url string `json:"url"`
type PreviewVariants struct {
Mp4 *PreviewSource `json:"mp4"`
Gif *PreviewSource `json:"gif"`
type PreviewImage struct {
Variants *PreviewVariants `json:"variants"`
type Preview struct {
Images []PreviewImage `json:"images"`
Source *PreviewSource `json:"source"`
type Submission struct {
CrosspostParent string `json:"crosspost_parent"`
// we don't care about the list, just does it exist or not
CrosspostParentList []interface{} `json:"crosspost_parent_list"`
Url string `json:"url"`
IsVideo bool `json:"is_video"`
SecureMedia *SecureMedia `json:"secure_media"`
IsGallery bool `json:"is_gallery"`
GalleryData *GalleryData `json:"gallery_data"`
MediaMetadata map[string]MediaMetadataItem `json:"media_metadata"`
IsRedditMediaDomain bool `json:"is_reddit_media_domain"`
Preview *Preview `json:"preview"`
IsSelf bool `json:"is_self"`
Title string `json:"title"`
type SubmissionChild struct {
Data *Submission `json:"data"`
type SubmissionResponseItemData struct {
Children []SubmissionChild `json:"children"`
type SubmissionResponseItem struct {
Data SubmissionResponseItemData `json:"data"`