downloader

package
v2.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: MIT Imports: 11 Imported by: 15

Documentation

Overview

Package downloader implements downloading from the osu! website, through, well, mostly scraping and dirty hacks.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoRedirect = errors.New("cheesegull/downloader: no redirect happened, beatmap could not be downloaded")

ErrNoRedirect is returned from Download when we were not redirect, thus indicating that the beatmap is unavailable.

Functions

This section is empty.

Types

type Client

type Client http.Client

Client is a wrapper around an http.Client which can fetch beatmaps from the osu! website.

func LogIn

func LogIn(username string, password string, requestPreparer LogInRequestPreparer) (*Client, error)

LogIn logs in into an osu! account and returns a Client.

func (*Client) Download

func (c *Client) Download(setID int, noVideo bool) (io.ReadCloser, error)

Download downloads a beatmap from the osu! website. noVideo specifies whether we should request the beatmap to not have the video.

func (*Client) HasVideo

func (c *Client) HasVideo(setID int) (bool, error)

HasVideo checks whether a beatmap has a video.

type EmptyLogInRequestPreparer

type EmptyLogInRequestPreparer struct{}

EmptyLogInRequestPreparer is a cookie preparer that returns an empty CookieJar

func (*EmptyLogInRequestPreparer) PrepareCookies

func (*EmptyLogInRequestPreparer) PrepareCookies() (http.CookieJar, error)

PrepareCookies returns an empty cookie jar

func (*EmptyLogInRequestPreparer) PrepareHeaders

func (*EmptyLogInRequestPreparer) PrepareHeaders() (map[string]string, error)

PrepareHeaders returns an empty map (i.e.: no additional headers)

type FckCf

type FckCf struct {
	Address string
	// contains filtered or unexported fields
}

FckCf is a LogInRequestPreparer that prepares cookies using FckCf

func (*FckCf) InitializeProxyResponse

func (c *FckCf) InitializeProxyResponse() error

InitializeProxyResponse initializes the

func (*FckCf) PrepareCookies

func (c *FckCf) PrepareCookies() (http.CookieJar, error)

PrepareCookies calls FckCf and returns a CookieJar with the required cookies

func (*FckCf) PrepareHeaders

func (c *FckCf) PrepareHeaders() (map[string]string, error)

type LogInRequestPreparer

type LogInRequestPreparer interface {
	PrepareCookies() (http.CookieJar, error)
	PrepareHeaders() (map[string]string, error)
}

LogInRequestPreparer prepares cookies to set before doing any osu! website http request (log-in)

Jump to

Keyboard shortcuts

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