scrape

package
v0.0.0-...-1109b79 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Scrape

func Scrape(skip string)

Types

type Content

type Content struct {
	Data struct {
		Question QuestionContent `json:"question"`
	} `json:"data"`
}

type Editor

type Editor struct {
	Data struct {
		Question QuestionEditor `json:"question"`
	} `json:"data"`
}

type Hints

type Hints struct {
	Data struct {
		Question QuestionHints `json:"question"`
	} `json:"data"`
}

type List

type List struct {
	Data struct {
		ProblemsetQuestionList struct {
			Total     int        `json:"total"`
			Questions []Question `json:"questions"`
		} `json:"problemsetQuestionList"`
	} `json:"data"`
}

type Question

type Question struct {
	AcRate             float64     `json:"acRate"`
	Difficulty         string      `json:"difficulty"`
	FreqBar            interface{} `json:"freqBar"`
	FrontendQuestionID string      `json:"frontendQuestionId"`
	IsFavor            bool        `json:"isFavor"`
	PaidOnly           bool        `json:"paidOnly"`
	Status             string      `json:"status"`
	Title              string      `json:"title"`
	TitleSlug          string      `json:"titleSlug"`
	TopicTags          []struct {
		Name string `json:"name"`
		ID   string `json:"id"`
		Slug string `json:"slug"`
	} `json:"topicTags"`
	HasSolution      bool `json:"hasSolution"`
	HasVideoSolution bool `json:"hasVideoSolution"`
}

func GetQuestionList

func GetQuestionList(skip string) ([]Question, error)

type QuestionContent

type QuestionContent struct {
	Content      string        `json:"content"`
	MysqlSchemas []interface{} `json:"mysqlSchemas"`
	DataSchemas  []interface{} `json:"dataSchemas"`
}

func GetQuestionContent

func GetQuestionContent(titleSlug string) (QuestionContent, error)

type QuestionEditor

type QuestionEditor struct {
	QuestionID         string `json:"questionId"`
	QuestionFrontendID string `json:"questionFrontendId"`
	CodeSnippets       []struct {
		Lang     string `json:"lang"`
		LangSlug string `json:"langSlug"`
		Code     string `json:"code"`
	} `json:"codeSnippets"`
	EnvInfo            string `json:"envInfo"`
	EnableRunCode      bool   `json:"enableRunCode"`
	HasFrontendPreview bool   `json:"hasFrontendPreview"`
	FrontendPreviews   string `json:"frontendPreviews"`
}

func GetQuestionEditorData

func GetQuestionEditorData(titleSlug string) (QuestionEditor, error)

type QuestionHints

type QuestionHints struct {
	Hints []string `json:"hints"`
}

func GetQuestionHints

func GetQuestionHints(titleSlug string) (QuestionHints, error)

type QuestionTitle

type QuestionTitle struct {
	QuestionID         string `json:"questionId"`
	QuestionFrontendID string `json:"questionFrontendId"`
	Title              string `json:"title"`
	TitleSlug          string `json:"titleSlug"`
	IsPaidOnly         bool   `json:"isPaidOnly"`
	Difficulty         string `json:"difficulty"`
	Likes              int    `json:"likes"`
	Dislikes           int    `json:"dislikes"`
	CategoryTitle      string `json:"categoryTitle"`
}

func GetQuestionTitle

func GetQuestionTitle(titleSlug string) (QuestionTitle, error)

type Store

type Store struct {
	DB *sql.DB
	Q  *db.Queries
}

func NewStore

func NewStore() *Store

func (*Store) GetQuestionData

func (s *Store) GetQuestionData(q Question, wg *sync.WaitGroup)

func (*Store) SaveQuestion

type Title

type Title struct {
	Data struct {
		Question QuestionTitle `json:"question"`
	} `json:"data"`
}

Jump to

Keyboard shortcuts

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