cambridge

package
v0.0.0-...-4993ae2 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	USER_AGENT         = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36"
	APP_VERSION_HEADER = "cambridgeone-app-version"
	APP_VERSION        = "v2"
	BASE_CAMBRIDGE_URL = "https://www.cambridgeone.org/nlp/apigateway/%s/product/%s/"
	LESSON_URL         = "https://content.cambridgeone.org/cup1/products/%s/2/assets/ext-cup-xapiscoreable/%s/data.js"
	COOKIE_NAME        = "c1_sid"
	AJAX_DATA          = "ajaxData"
	AJAX_DATA_ERROR    = "ajaxData not found"
)
View Source
const (
	GENERIC_QUESTION_REGEX    = `<p>Incorrect!<br />\s*Correct answer:<br />\s*(.+)</p>`
	NORMAL_QUESTION_REGEX     = `<correctResponse>(.*?)<\/correctResponse>`
	MULTI_QUESTION_REGEX      = `Correct Answer:&lt;br /> (.*?)&lt;/p>`
	CHOICE_QUESTION_REGEX     = `(?s)Correct answers:<br />(.*?)</p>`
	VALUE_RESPONSE_REGEX      = `<value>(.*?)</value>`
	POSSIBLE_QUESTION_REGEX   = `(?s)Possible answers:<br />(.*?)</p>`
	QUESTION_IDENTIFIER_REGEX = `identifier="([^"]+)"`
)
View Source
const (
	INVALID_QUESTION_TYPE   = "Present:Present:Present"
	LEARNING_OBJECTINFO_XML = "LearningObjectInfo.xml"
	CORRECT_ANSWERS_FINDER  = "Correct answers:"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cambridge

type Cambridge struct {
	// contains filtered or unexported fields
}

func NewCambridge

func NewCambridge(org, product, cookie string) *Cambridge

func (*Cambridge) GetLessonResponse

func (c *Cambridge) GetLessonResponse(productCode, lessonId string) ([]string, error)

func (*Cambridge) GetUnits

func (c *Cambridge) GetUnits(class string) (*UnitsResult, error)

type CupOptions

type CupOptions struct {
	Contentid string `json:"contentid"`
	Title     string `json:"title"`
	Engine    string `json:"engine"`
	DP        string `json:"dp"`
	LmsApis   string `json:"lmsApis"`
}

type EXTCupXapiscoreable

type EXTCupXapiscoreable struct {
	URL        string     `json:"url"`
	Filename   string     `json:"filename"`
	Filesize   int64      `json:"filesize"`
	Container  string     `json:"container"`
	CupOptions CupOptions `json:"cup-options"`
}

type ItemItem

type ItemItem struct {
	Name                string              `json:"name"`
	ItemCode            string              `json:"item-code"`
	Resource            string              `json:"resource"`
	EXTCupXapiscoreable EXTCupXapiscoreable `json:"ext-cup-xapiscoreable"`
}

type Result

type Result struct {
	Name     string       `json:"name"`
	ItemType string       `json:"item-type"`
	ItemCode string       `json:"item-code"`
	SubType  string       `json:"sub-type"`
	Items    []ResultItem `json:"items"`
}

type ResultItem

type ResultItem struct {
	Name     string     `json:"name"`
	ItemType string     `json:"item-type"`
	ItemCode string     `json:"item-code"`
	SubType  string     `json:"sub-type"`
	Items    []ItemItem `json:"items"`
}

type Toc

type Toc struct {
	Result []Result `json:"result"`
}

type UnitsResult

type UnitsResult struct {
	Toc Toc `json:"toc"`
}

Jump to

Keyboard shortcuts

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