parse

package
v0.0.0-...-2c598c9 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 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

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

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

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

func IsLoggedIn

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

func IsLoggedInDOM(doc *goquery.Document) bool

func LoginFormTokens

func LoginFormTokens(body io.Reader) map[string]string

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

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 VerificationTokenFromDom

func VerificationTokenFromDom(dom *goquery.Document) string

func WifiMacInfo

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