parse

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrFailedToParse    = "failed to parse"
	ErrFailedToParseDOM = ErrFailedToParse + " DOM"
	ErrNotLoggedIn      = ErrFailedToParse + ": not logged in"
)

Errors

View Source
const ExamTitleUnknown = "Unknown Exam"

Variables

This section is empty.

Functions

func Attendance

func Attendance(body io.Reader) (models.AttendanceRecords, error)

Attendance attempts to parse course attendance information from the Amizone home page into a models.AttendanceRecords instance.

func ClassSchedule

func ClassSchedule(body io.Reader) (models.ClassSchedule, error)

ClassSchedule attempts to parse the response of the Amizone diary events API endpoint into a models.ClassSchedule instance.

func CleanString added in v0.6.1

func CleanString(s string, set ...rune) string

CleanString trims off whitespace and additional runes passed.

func Courses

func Courses(body io.Reader) (models.Courses, error)

Courses parses the Amizone courses page.

func ExaminationResult added in v0.8.0

func ExaminationResult(body io.Reader) (*models.ExamResultRecords, error)

ExaminationResult attempts to parse exam result information from the Amizone Examination Results page into a models.ExaminationResultRecords instance.

func ExaminationSchedule

func ExaminationSchedule(body io.Reader) (*models.ExaminationSchedule, error)

ExaminationSchedule attempts to parse a page into a models.ExaminationSchedule model. This function expects the Amizone "Examination Schedule" page, parsable into an HTML document.

func FacultyFeedback added in v0.6.0

func FacultyFeedback(body io.Reader) (models.FacultyFeedbackSpecs, error)

func IsLoggedIn added in v0.2.0

func IsLoggedIn(body io.Reader) bool

IsLoggedIn attempts to determine whether a response body indicates an authenticated session. To achieve this, this function will first attempt to parse the body as an HTML document, failing to do which is assumed to indicate an authenticated session because Amizone seems to redirect unauthenticated requests from all endpoints to the login page. If the body is parsed into a HTMl document, this function will attempt to find the login form; failing to find the login form is assumed to indicate an authenticated session.

func IsLoggedInDOM added in v0.2.0

func IsLoggedInDOM(doc *goquery.Document) bool

func Profile

func Profile(body io.Reader) (*models.Profile, error)

func Semesters

func Semesters(body io.Reader) (models.SemesterList, error)

Semesters returns the number of ongoing or passed semesters from the Amizone courses page.

func UnescapeUnicode added in v0.4.0

func UnescapeUnicode(s string) string

UnescapeUnicode unescapes unicode characters in a string. Ref: https://groups.google.com/g/golang-nuts/c/KO1yubIbKpU/m/ue_EU8dcBQAJ

func VerificationToken

func VerificationToken(body io.Reader) string

func VerificationTokenFromDom added in v0.3.0

func VerificationTokenFromDom(dom *goquery.Document) string

func WifiMacInfo added in v0.3.0

func WifiMacInfo(body io.Reader) (*models.WifiMacInfo, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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