supcomgo

package module
v0.0.0-...-49623b9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2023 License: MIT Imports: 8 Imported by: 0

README

supcomgo

A simple Supreme Community scraper written in GoLang, utilizing GoQuery, net/http, and a package written by myself that makes writing Discord embeds much easier.

Usage
package main

import "github.com/aiomonitors/supcomgo"

func main() {
    link := supcomgo.GetLatestDroplistLink()
    items := supcomgo.ScrapeDroplist(link)
    SendDroplist(items, webhook)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToJSON

func ConvertToJSON(items Droplist) ([]byte, error)

ConvertToJSON converts a given droplist to JSON Returns []byte

func GetLatestDroplistLink() string

GetLatestDroplistLink returns the latest droplist link on SupremeCommunity

func SaveAsJSON

func SaveAsJSON(items Droplist, path string) error

SaveAsJSON saves a given Droplist item to a given path as JSON Returns error

func SendDroplist

func SendDroplist(items Droplist, webhook string)

SendDroplist sends the droplist to a provided webhook

Types

type DropItem

type DropItem struct {
	Name        string `json:"name"`
	Image       string `json:"image"`
	Description string `json:"description,omitempty"`
	Category    string `json:"category,omitempty"`
	Price       Price  `json:"price,omitempty"`
	Votes       Votes  `json:"votes"`
	Link        string `json:"link,omitempty"`
}

DropItem is a struct for an item of the droplist

type Droplist

type Droplist []DropItem

Droplist is an array of DropItem's

func ScrapeDroplist

func ScrapeDroplist(link string) Droplist

ScrapeDroplist scrapes the droplsit from the link provided

type Price

type Price struct {
	FullPrice   string `json:"full_price"`
	DollarPrice string `json:"dollar_price"`
	PoundsPrice string `json:"pounds_price"`
}

Price is a struct for prices on an item

type Votes

type Votes struct {
	Upvotes   string `json:"upvotes"`
	Downvotes string `json:"downvotes"`
}

Votes is a struct for votes on an item

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL