scrapers

package
v0.0.0-...-8c4bcf2 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StarshipURL = "https://www.spacex.com/vehicles/starship/"
)

Variables

View Source
var ErrNoInfo = errors.New("no info")
View Source
var ErrNoVideo = errors.New("not live")
View Source
var ShipNameRegex = regexp.MustCompile(`\b((?:SN|S|Star[Ss]hip)-?\s*\d+)\b`)

Functions

This section is empty.

Types

type LiveBroadcastDetails

type LiveBroadcastDetails struct {
	StartTimestamp time.Time `json:"startTimestamp"`
}

type LiveVideo

type LiveVideo struct {
	VideoID string `json:"videoId"`
	Title   string `json:"title"`
	IsLive  bool   `json:"isLive"`

	ChannelID string `json:"channelId"`

	ShortDescription string `json:"shortDescription"`
	IsUpcoming       bool   `json:"isUpcoming"`

	UpcomingInfo LiveBroadcastDetails
	// contains filtered or unexported fields
}

This struct only contains minimal info, there is more but I don't care about other info we can get

func YouTubeLive

func YouTubeLive(channelLiveURL string) (lv LiveVideo, err error)

YouTubeLive extracts a live stream from a channel live url. This kind of URL looks like the following:

https://www.youtube.com/channel/UCSUu1lih2RifWkKtDOJdsBA/live
https://www.youtube.com/spacex/live

It also extract streams that are upcoming

func (*LiveVideo) TimeUntil

func (lv *LiveVideo) TimeUntil() (t time.Time, d time.Duration, ok bool)

func (*LiveVideo) URL

func (lv *LiveVideo) URL() string

URL returns the youtube video URL for this live stream

type StarshipInfo

type StarshipInfo struct {
	ShipName       string
	NextFlightDate time.Time

	Orbital bool

	LiveStreamID string
}

func SpaceXStarship

func SpaceXStarship(websiteURL string, now time.Time) (s StarshipInfo, err error)

SpaceXStarship returns info about the starship page (ship name & first mentioned date)

func (*StarshipInfo) Equals

func (s *StarshipInfo) Equals(b StarshipInfo) bool

type UnixTime

type UnixTime time.Time

func (*UnixTime) UnmarshalJSON

func (t *UnixTime) UnmarshalJSON(b []byte) (err error)

Jump to

Keyboard shortcuts

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