Library
Module
Module type
Parameter
Class
Class type
Page
This module contains all the functions used to analyze a page, select specific elements, and manage forms.
val from_soup : ?location:Uri.t -> Soup.soup Soup.node -> t
Make a new page from a base URI and a Lambdasoup document
val from_string : ?location:Uri.t -> string -> t
Make a new page from a base URI and an HTML string
val base_uri : t -> Uri.t
Return the location of a page (or Uri.empty
if not specified)
val resolver : t -> Uri.t -> Uri.t
Return the resolver of page, which is a function that takes relative URIs of the page to absolute ones using the page base URI
val soup : t -> Soup.soup Soup.node
Convert to a Lambdasoup HTML node
Lambdasoup provides lazy sequences to traverse only needed part of an HTML document when used in combination with with_stop
. We provide a wrapper that is compatible with Mechaml types such as forms, images, inputs, etc.
Operations on lazy sequences
val iter : ('a -> unit) -> 'a seq -> unit
val fold : ('a -> 'b -> 'a) -> 'a -> 'b seq -> 'a
val first : 'a seq -> 'a option
val nth : int -> 'a seq -> 'a option
val find_first : ('a -> bool) -> 'a seq -> 'a option
val to_list : 'a seq -> 'a list
val with_stop : ('a stop -> 'a) -> 'a
see Lambdasoup's Soup.with_stop
module Form : sig ... end
Operations on forms and inputs
module Link : sig ... end
Operations on hypertext links
module Image : sig ... end
Operations on images
All the following function are built using the same pattern.
forms
) return all the elements of a certain type as a lazy sequence. For example, forms mypage
will return all the forms in the pageNone
if there isn't any. Eg, link_with "[href$=.jpg]" mypage
will try to find a link that point to a JPEG image