parser

package
v1.5.8 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseSessionId

func ParseSessionId(content string) string

ParseSessionId extracts the sessid value from the provided HTML content.

Parameters:

  • content (string): A string containing the HTML content to search for an input element with name="sessid".

Returns:

  • string: The value of the "value" attribute from the found input element with name="sessid". If no such element is found, it returns an empty string.

Description: The function parses the given HTML content and recursively traverses the DOM tree to locate an <input> element where the name attribute equals "sessid". Once found, it extracts and returns the value of its value attribute.

func ParseVersions

func ParseVersions(content string) (types.Versions, error)

ParseVersions extracts version flags from the provided HTML content.

Parameters:

  • content (string): A string containing HTML content that includes a table of version rows.

Returns:

  • Versions: A map where each key is a version string (e.g., "3.0.10") and the value is a VersionLabel constant (Alpha, Beta, or Stable) representing the selected flag.
  • error: An error if the target versions table is not found in the HTML; otherwise, nil.

Description: ParseVersions parses the given HTML content and looks for a <table> element with the class "data-table mt-3 mb-3". It iterates over each <tr> row within the table's <tbody> section, extracting the version string (from the first <td>) and identifying which radio input is currently checked (determining the selected VersionLabel). The results are collected into a Versions map, where keys are version identifiers and values are the selected flags. If the expected table is not found, the function returns an error.

func UploadResult

func UploadResult(content string) error

UploadResult processes the HTML content returned from the upload request to check for error messages.

The function parses the HTML content and searches for a <p> element with a specific CSS class (`paragraph-15 color-red m-0`), which indicates an error message. If such an element is found, the error message is extracted and returned as an error.

Parameters:

  • htmlContent: The HTML response body to be parsed for error messages.

Returns:

  • An error if an error message is found in the HTML content or nil if no errors are present.

Types

This section is empty.

Jump to

Keyboard shortcuts

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