Documentation
¶
Index ¶
- type AlternateLink
- type ConfigError
- type Image
- type LastModTime
- type NetworkError
- type News
- type NewsPublication
- type ParseError
- type S
- func (s *S) GetErrors() []error
- func (s *S) GetErrorsCount() int64
- func (s *S) GetFetchTimeout() uint16
- func (s *S) GetFollow() []string
- func (s *S) GetHTTPClient() *http.Client
- func (s *S) GetMaxConcurrency() int
- func (s *S) GetMaxDepth() int
- func (s *S) GetMaxResponseSize() int64
- func (s *S) GetMaxSitemaps() int
- func (s *S) GetMaxURLs() int
- func (s *S) GetMultiThread() bool
- func (s *S) GetRandomURLs(n int) []URL
- func (s *S) GetRules() []string
- func (s *S) GetStrict() bool
- func (s *S) GetURLCount() int64
- func (s *S) GetURLs() []URL
- func (s *S) GetUserAgent() string
- func (s *S) Parse(url string, urlContent *string) (*S, error)
- func (s *S) ParseContext(ctx context.Context, url string, urlContent *string) (*S, error)
- func (s *S) SetFetchTimeout(fetchTimeout uint16) *S
- func (s *S) SetFollow(regexes []string) *S
- func (s *S) SetHTTPClient(client *http.Client) *S
- func (s *S) SetMaxConcurrency(maxConcurrency int) *S
- func (s *S) SetMaxDepth(maxDepth int) *S
- func (s *S) SetMaxResponseSize(maxResponseSize int64) *S
- func (s *S) SetMaxSitemaps(maxSitemaps int) *S
- func (s *S) SetMaxURLs(maxURLs int) *S
- func (s *S) SetMultiThread(multiThread bool) *S
- func (s *S) SetRules(regexes []string) *S
- func (s *S) SetStrict(strict bool) *S
- func (s *S) SetUserAgent(userAgent string) *S
- type URL
- type URLChangeFreq
- type ValidationError
- type Video
- type VideoPlatform
- type VideoRestriction
- type VideoUploader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlternateLink ¶ added in v1.0.0
type AlternateLink struct {
Rel string `xml:"rel,attr"`
Hreflang string `xml:"hreflang,attr"`
Href string `xml:"href,attr"`
}
AlternateLink represents an alternate version of a page (hreflang) per the XHTML standard used in sitemaps. Reference: https://developers.google.com/search/docs/specialty/international/localized-versions#sitemap
type ConfigError ¶ added in v0.9.0
type ConfigError struct {
// Field is the configuration field name (e.g. "maxDepth", "follow", "rules").
Field string
// Err is the underlying validation error.
Err error
}
ConfigError is returned when a configuration setter receives an invalid value. Callers can inspect the Field to determine which configuration setting caused the error.
Example usage:
var cfgErr *sitemap.ConfigError
if errors.As(err, &cfgErr) {
fmt.Println("bad config field:", cfgErr.Field)
}
func (*ConfigError) Error ¶ added in v0.9.0
func (e *ConfigError) Error() string
func (*ConfigError) Unwrap ¶ added in v0.9.0
func (e *ConfigError) Unwrap() error
Unwrap returns the underlying error, enabling errors.Is / errors.As traversal.
type Image ¶ added in v0.7.0
type Image struct {
Loc string `xml:"http://www.google.com/schemas/sitemap-image/1.1 loc"`
Title string `xml:"http://www.google.com/schemas/sitemap-image/1.1 title"`
Caption string `xml:"http://www.google.com/schemas/sitemap-image/1.1 caption"`
GeoLocation string `xml:"http://www.google.com/schemas/sitemap-image/1.1 geo_location"`
License string `xml:"http://www.google.com/schemas/sitemap-image/1.1 license"`
}
Image is a structure of <image:image> in <url>, per the Google Image Sitemap extension. Reference: https://developers.google.com/search/docs/crawling-indexing/sitemaps/image-sitemaps
type LastModTime ¶ added in v1.0.0
LastModTime is the date, or the date and time, that a <lastmod> element or a date element of an extension holds. It embeds time.Time.
In the URLs that Parse and ParseContext collect, a field of this type is nil when the element is absent, when it is empty, and when what it holds cannot be parsed. A field that is set therefore holds the date the document gives.
func (*LastModTime) UnmarshalXML ¶ added in v1.0.0
func (l *LastModTime) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements xml.Unmarshaler, for code that decodes sitemap XML with encoding/xml itself. It accepts a date or a date and time in one of the W3C formats the sitemaps.org protocol allows, and fails for anything else.
An element that is empty, or holds only whitespace, is not an error and leaves l as it is. Note that encoding/xml allocates a pointer field for every element it meets, so a *LastModTime field decoded this way is not nil for an empty element: it holds the zero time, which IsZero tells. Parse and ParseContext do not read dates this way; in the URLs they collect, the field of an empty element is nil.
type NetworkError ¶ added in v0.9.0
type NetworkError struct {
// URL is the URL that was being fetched when the error occurred.
URL string
// Err is the underlying network or HTTP error.
Err error
}
NetworkError is returned when an HTTP fetch fails. Callers can inspect URL to determine which resource could not be retrieved.
Example usage:
var netErr *sitemap.NetworkError
if errors.As(err, &netErr) {
fmt.Println("failed to fetch:", netErr.URL)
}
func (*NetworkError) Error ¶ added in v0.9.0
func (e *NetworkError) Error() string
func (*NetworkError) Unwrap ¶ added in v0.9.0
func (e *NetworkError) Unwrap() error
Unwrap returns the underlying error, enabling errors.Is / errors.As traversal.
type News ¶ added in v0.7.0
type News struct {
Publication NewsPublication `xml:"http://www.google.com/schemas/sitemap-news/0.9 publication"`
PublicationDate *LastModTime `xml:"http://www.google.com/schemas/sitemap-news/0.9 publication_date"`
Title string `xml:"http://www.google.com/schemas/sitemap-news/0.9 title"`
}
News is a structure of <news:news> in <url>, per the Google News Sitemap extension. Reference: https://developers.google.com/search/docs/crawling-indexing/sitemaps/news-sitemap
type NewsPublication ¶ added in v0.7.0
type NewsPublication struct {
Name string `xml:"http://www.google.com/schemas/sitemap-news/0.9 name"`
Language string `xml:"http://www.google.com/schemas/sitemap-news/0.9 language"`
}
NewsPublication is a structure of <news:publication> in <news:news>.
type ParseError ¶ added in v0.9.0
type ParseError struct {
// URL is the sitemap URL that was being parsed when the error occurred. For a sitemap
// reached through a redirect it is the URL the sitemap was served from.
// When the depth limit is reached, it is the sitemap index whose sitemaps were not
// followed. When the limit on the sitemaps or on the URLs of a call is reached, or the
// call was cut short, it is the URL the call was made for.
URL string
// Err is the underlying parse error.
Err error
}
ParseError is returned when XML or gzip parsing of a sitemap document fails. Callers can inspect URL to determine which sitemap could not be parsed.
It is also the error of a parse that was not carried through for another reason: the sitemaps a sitemap index lists were not followed because the depth limit is reached, sitemaps or URLs were left out because the limit on the sitemaps or on the URLs of a call is reached, or the call was cut short because its context is done. In the latter case Err is the error of the context, so errors.Is matches context.Canceled and context.DeadlineExceeded.
Example usage:
var parseErr *sitemap.ParseError
if errors.As(err, &parseErr) {
fmt.Println("failed to parse sitemap:", parseErr.URL)
}
func (*ParseError) Error ¶ added in v0.9.0
func (e *ParseError) Error() string
func (*ParseError) Unwrap ¶ added in v0.9.0
func (e *ParseError) Unwrap() error
Unwrap returns the underlying error, enabling errors.Is / errors.As traversal.
type S ¶
type S struct {
// contains filtered or unexported fields
}
S is a structure that holds various data related to processing URLs. It contains a cfg field of type `config`, which stores configuration settings. The mainURL field of type string represents the main URL being processed. The robotsTxtSitemapURLs field is a slice of strings that contains the URLs present in the robots.txt file's sitemap directive. The sitemapLocations field is a slice of strings that represents the locations of the sitemap files. The urls field is a slice of URL structs that stores the URLs to be processed. The errs field is a slice of errors that holds any encountered errors during processing.
func New ¶
func New() *S
New creates a new instance of the S structure. It initializes the structure with default configuration values and returns a pointer to the created instance.
func (*S) GetErrorsCount ¶
func (*S) GetFetchTimeout ¶ added in v1.0.0
GetFetchTimeout returns the current fetch timeout in seconds.
func (*S) GetFollow ¶ added in v1.0.0
GetFollow returns a copy of the current follow regex pattern strings.
func (*S) GetHTTPClient ¶ added in v1.0.0
GetHTTPClient returns the custom HTTP client, or nil if the default client behaviour is used.
func (*S) GetMaxConcurrency ¶ added in v1.0.0
GetMaxConcurrency returns the maximum number of sitemaps fetched or parsed at the same time. A value of 0 means unlimited concurrency.
func (*S) GetMaxDepth ¶ added in v1.0.0
GetMaxDepth returns the maximum recursion depth for following sitemap indexes.
func (*S) GetMaxResponseSize ¶ added in v1.0.0
GetMaxResponseSize returns the maximum allowed HTTP response size in bytes.
func (*S) GetMaxSitemaps ¶ added in v1.2.0
GetMaxSitemaps returns the maximum number of sitemaps a Parse or ParseContext call fetches. A value of 0 means no limit.
func (*S) GetMaxURLs ¶ added in v1.2.0
GetMaxURLs returns the maximum number of URLs a Parse or ParseContext call collects. A value of 0 means no limit.
func (*S) GetMultiThread ¶ added in v1.0.0
GetMultiThread returns whether multi-threaded fetching and parsing is enabled.
func (*S) GetRandomURLs ¶
GetRandomURLs returns a slice of randomly selected URLs from the S object's URL list. The number of URLs to select is specified by the parameter n. If n exceeds the number of URLs in the list, all of them are returned, in random order. If n is zero or negative, or the S object is nil, an empty slice is returned. The function creates a copy of the original URLs list and randomly selects n URLs from it, removing them to avoid duplicates. The selected URLs are returned as a new slice.
func (*S) GetRules ¶ added in v1.0.0
GetRules returns a copy of the current URL filter regex pattern strings.
func (*S) GetStrict ¶ added in v1.0.0
GetStrict returns whether strict URL validation mode is enabled.
func (*S) GetURLCount ¶
GetURLCount returns the count of URLs in the S struct.
func (*S) GetUserAgent ¶ added in v1.0.0
GetUserAgent returns the current user agent string used for HTTP requests.
func (*S) Parse ¶
Parse is a method of the S structure. It parses the given URL and its content.
Parse is a backward-compatible wrapper around ParseContext that uses context.Background(). For new code, prefer ParseContext so that callers can propagate cancellation and deadlines.
An instance can be reused: every call first discards the URLs and errors collected by the previous call. Configuration errors recorded by the Set* methods are the exception. They persist across calls, and while any of them is outstanding Parse does not parse anything and returns an error with the message "errors occurred before parsing, see GetErrors() for details". Calling the same setter again with a valid value clears its error.
A sitemap that is reached through a redirect is located at the URL it was served from, not at the URL that was requested: relative URLs in it are resolved against that URL, strict mode compares the URLs it lists with that URL, and the errors about the document name it.
It sets the mainURL field to the given URL. The content is the given URL content or, if that is nil, what the URL serves. If the URL ends with "/robots.txt", it parses the robots.txt file and fetches URLs from the sitemap files mentioned in the robots.txt. If the URL does not end with "/robots.txt", the content is checked and unzipped if necessary, then parsed and fetched. The content of a document is not kept once the document is parsed.
A call fetches no more sitemaps than SetMaxSitemaps allows, and collects no more URLs than SetMaxURLs allows, so that it comes to an end whatever the documents list.
It returns the S structure, and a nil error if the document at the given URL was fetched and parsed. Otherwise the error tells why it was not:
- a configuration error is outstanding, see above;
- the URL is not valid: a *ValidationError;
- the document could not be fetched: a *NetworkError;
- the document could not be parsed: a *ParseError.
Except for the first, the error returned is the one GetErrors() holds about it. What goes wrong further on is in GetErrors() only and does not fail the call: a sitemap the document lists that cannot be fetched or parsed, a limit that is reached, an entry that is not valid.
func (*S) ParseContext ¶ added in v0.4.0
ParseContext parses the given URL and its content, honoring the supplied context for cancellation and deadlines.
The context is propagated through every HTTP request issued by the parser (both the initial fetch and the recursive sitemap-index/urlset fetches), so cancelling ctx aborts in-flight downloads and prevents new ones from starting. Already-parsed URLs accumulated in s.urls before cancellation remain available via GetURLs().
If ctx is done by the time the call ends, ParseContext returns a *ParseError that names the given URL and wraps the error of ctx, so errors.Is matches context.Canceled and context.DeadlineExceeded. The same error is recorded in the error list, once for the call: whether the sitemaps are fetched concurrently or one at a time, and however many of them were not fetched. A request that was cut short is recorded as the *NetworkError of that sitemap in addition.
A call that fails for the given URL itself, as described at Parse, returns and records that error alone. This is the case when it is the request for the given URL that is cut short: the error is the *NetworkError of that request, which wraps the error of ctx as well.
All other semantics match Parse.
func (*S) SetFetchTimeout ¶
SetFetchTimeout sets the fetch timeout for the Sitemap Parser. The fetch timeout determines how long the parser will wait for an HTTP request to complete. It should be specified in seconds as a uint16 value and must be greater than 0. Invalid values are ignored and a *ConfigError is recorded; a later call with a valid value clears it. Note: when a custom HTTP client is set via SetHTTPClient, this value has no effect. The function returns a pointer to the S structure to allow method chaining.
func (*S) SetFollow ¶ added in v0.1.3
SetFollow sets the follow patterns using the provided list of regex strings and compiles them into regex objects. When patterns are set, only the sitemaps whose URL matches one of them are fetched, whether a sitemap index lists them or a robots.txt names them. The URL passed to Parse is always fetched. Patterns longer than maxRegexPatternLength characters are rejected with a *ConfigError. Any errors encountered during compilation are recorded as *ConfigError values. Each call replaces both the patterns and the errors recorded by the previous call. The function returns a pointer to the S structure to allow method chaining.
func (*S) SetHTTPClient ¶ added in v0.6.0
SetHTTPClient sets a custom HTTP client for the Sitemap Parser. When set, the provided client is used for all HTTP requests instead of the internally created default client. This allows callers to configure custom transports, proxies, TLS settings, authentication, or timeout strategies. When a custom client is provided, SetFetchTimeout has no effect; the client's own Timeout field controls the request deadline. Pass nil to reset to the default client behaviour. The function returns a pointer to the S structure to allow method chaining.
func (*S) SetMaxConcurrency ¶ added in v0.4.0
SetMaxConcurrency sets the maximum number of sitemaps that are worked on at the same time when multi-threaded parsing is enabled. The default is 16. A value of 0 means unlimited concurrency. A positive value caps the number of sitemaps that are being fetched or parsed at any one time across the recursive sitemap-index traversal: a sitemap counts from the moment its request is sent until its content is parsed. That bounds the connections in use and the documents held in memory, which is recommended for very large sitemap indexes to avoid goroutine and connection blow-up. Negative values are rejected and a *ConfigError is recorded; a later call with a valid value clears it. The function returns a pointer to the S structure to allow method chaining.
func (*S) SetMaxDepth ¶ added in v0.3.0
SetMaxDepth sets the maximum recursion depth for following sitemap indexes. A sitemap index may reference other sitemap indexes; this limits how many levels deep the parser will follow. The default is 10. The value must be greater than 0; invalid values are ignored and a *ConfigError is recorded. A later call with a valid value clears it. The function returns a pointer to the S structure to allow method chaining.
func (*S) SetMaxResponseSize ¶ added in v0.3.0
SetMaxResponseSize sets the maximum allowed HTTP response size in bytes. Responses exceeding this limit are rejected with a *NetworkError. The same limit caps the decompressed size of gzip-compressed content, whether it was fetched or supplied through the urlContent argument of Parse; content that expands beyond it is rejected with a *ParseError. The default is 50 MB, matching the sitemaps.org protocol limit. The value must be greater than 0; invalid values are ignored and a *ConfigError is recorded. A later call with a valid value clears it. The function returns a pointer to the S structure to allow method chaining.
func (*S) SetMaxSitemaps ¶ added in v1.2.0
SetMaxSitemaps sets the maximum number of sitemaps a Parse or ParseContext call fetches. The default is 50,000, which is as many sitemaps as a sitemap index may list according to the sitemaps.org protocol. A value of 0 means no limit.
The sitemaps a robots.txt or a sitemap index lists count, on every level together: each one the call requests, whether or not the request succeeds. A sitemap that is listed more than once is requested and counted once. The document the call is made for does not count.
Once the limit is reached, the sitemaps that are left are not fetched, and a *ParseError naming the URL the call was made for is recorded, once for the call. The call does not fail: what the sitemaps fetched until then yielded is returned. With multi-threading off, the sitemaps are fetched in the order they are listed, so it is the first ones that are fetched; with multi-threading on, which ones are depends on how fast the server answers. Nothing is recorded if no sitemap had to be left out.
The limit bounds the number of requests a document can make the parser send. Without it, a server can keep a call busy for as long as it likes by listing sitemaps that list ever further sitemaps.
Negative values are rejected and a *ConfigError is recorded; a later call with a valid value clears it. The value that applies to a call is the one set when the call starts. The function returns a pointer to the S structure to allow method chaining.
func (*S) SetMaxURLs ¶ added in v1.2.0
SetMaxURLs sets the maximum number of URLs a Parse or ParseContext call collects. The default is 10,000,000. A value of 0 means no limit.
The URLs that GetURLs returns count. An entry that is not valid does not, and neither does a URL that the patterns set with SetRules leave out.
Once the limit is reached, the call stops collecting: what is left of the document that reached the limit is left out unread, so it adds no errors either, the sitemaps that are left are not fetched, and a *ParseError naming the URL the call was made for is recorded, once for the call. The call does not fail: the URLs collected until then are returned. With multi-threading off, they are the first ones in the order the sitemaps list them; with multi-threading on, which ones they are depends on how fast the server answers. Nothing is recorded if nothing had to be left out.
The limit bounds the memory the URLs of a call take up, whatever the documents list. The default is a last resort rather than a tight bound: ten million URLs take up gigabytes. Set a lower limit for documents that are not trusted.
Negative values are rejected and a *ConfigError is recorded; a later call with a valid value clears it. The value that applies to a call is the one set when the call starts. The function returns a pointer to the S structure to allow method chaining.
func (*S) SetMultiThread ¶ added in v0.1.2
SetMultiThread sets the multi-threading for the Sitemap Parser. The multi-threading flag determines whether the parser should fetch and parse the sitemaps concurrently using goroutines. When it is off, the sitemaps are fetched one at a time and in the order they are listed, those a robots.txt names as well as those of a sitemap index, and SetMaxConcurrency has no effect. The function returns a pointer to the S structure to allow method chaining.
func (*S) SetRules ¶ added in v0.1.3
SetRules sets the rules patterns using the provided list of regex strings and compiles them into regex objects. Patterns longer than maxRegexPatternLength characters are rejected with a *ConfigError. Any errors encountered during compilation are recorded as *ConfigError values. Each call replaces both the patterns and the errors recorded by the previous call. The function returns a pointer to the S structure to allow method chaining.
func (*S) SetStrict ¶ added in v0.3.0
SetStrict enables or disables strict mode for URL validation. In strict mode, all URLs in sitemap <loc> elements must be absolute HTTP(S) URLs on the same host and protocol as the sitemap file, must hold neither a space nor a control character and must not exceed 2048 characters, as required by the sitemaps.org specification. The host is compared without regard to letter case, and the default port of the protocol is the same as no port. In tolerant mode (default), relative URLs are resolved against the parent sitemap URL, and a space in a URL is percent-encoded. The function returns a pointer to the S structure to allow method chaining.
func (*S) SetUserAgent ¶
SetUserAgent sets the user agent for the Sitemap Parser. The user agent is used for making HTTP requests when parsing and fetching URLs. It should be a string representing the user agent header value. The function returns a pointer to the S structure to allow method chaining.
type URL ¶
type URL struct {
Loc string `xml:"loc"`
LastMod *LastModTime `xml:"lastmod"`
ChangeFreq *URLChangeFreq `xml:"changefreq"`
Priority *float32 `xml:"priority"`
Images []Image `xml:"http://www.google.com/schemas/sitemap-image/1.1 image"`
News *News `xml:"http://www.google.com/schemas/sitemap-news/0.9 news"`
Videos []Video `xml:"http://www.google.com/schemas/sitemap-video/1.1 video"`
Hreflangs []AlternateLink `xml:"http://www.w3.org/1999/xhtml link"`
}
URL is a structure of <url> in <urlset>.
In the URLs that Parse and ParseContext collect, no text value has whitespace around it: the whitespace that surrounds the content of an element or the value of an attribute is not taken for a part of it. This goes for the fields of the extensions as well.
type URLChangeFreq ¶ added in v0.3.0
type URLChangeFreq string
URLChangeFreq represents the frequency at which a URL should be crawled and indexed. Possible values are: "always", "hourly", "daily", "weekly", "monthly", "yearly", and "never".
In the URLs that Parse and ParseContext collect, a field of this type is nil when the <changefreq> element is absent or empty. In tolerant mode one of the values above that is written in another letter case, such as "Daily", is replaced by the value itself, so that it equals its constant, and any other value is kept as the document gives it. Strict mode skips and reports an entry whose value is not one of the values above as they are written here, so a field that is set equals one of the constants there.
const ( // ChangeFreqAlways represents the "always" value for URLChangeFreq. ChangeFreqAlways URLChangeFreq = "always" // ChangeFreqHourly represents the "hourly" value for URLChangeFreq. ChangeFreqHourly URLChangeFreq = "hourly" // ChangeFreqDaily represents the "daily" value for URLChangeFreq. ChangeFreqDaily URLChangeFreq = "daily" // ChangeFreqWeekly represents the "weekly" value for URLChangeFreq. ChangeFreqWeekly URLChangeFreq = "weekly" // ChangeFreqMonthly represents the "monthly" value for URLChangeFreq. ChangeFreqMonthly URLChangeFreq = "monthly" // ChangeFreqYearly represents the "yearly" value for URLChangeFreq. ChangeFreqYearly URLChangeFreq = "yearly" // ChangeFreqNever represents the "never" value for URLChangeFreq. ChangeFreqNever URLChangeFreq = "never" )
type ValidationError ¶ added in v0.9.0
type ValidationError struct {
// URL is the URL value being validated. When it is not a URL that was rejected, it is the
// URL the rejected value belongs to: the page for a value of a <url> entry, the sitemap
// for an entry without a location. For a sitemap reached through a redirect that is the
// URL the sitemap was served from.
// May be empty for field-level errors where no specific URL is available.
URL string
// Err is the underlying validation error.
Err error
}
ValidationError is returned when a URL or field value fails validation. Callers can inspect URL to determine which value was rejected.
Example usage:
var valErr *sitemap.ValidationError
if errors.As(err, &valErr) {
fmt.Println("invalid URL:", valErr.URL)
}
func (*ValidationError) Error ¶ added in v0.9.0
func (e *ValidationError) Error() string
func (*ValidationError) Unwrap ¶ added in v0.9.0
func (e *ValidationError) Unwrap() error
Unwrap returns the underlying error, enabling errors.Is / errors.As traversal.
type Video ¶ added in v0.8.0
type Video struct {
ThumbnailLoc string `xml:"http://www.google.com/schemas/sitemap-video/1.1 thumbnail_loc"`
Title string `xml:"http://www.google.com/schemas/sitemap-video/1.1 title"`
Description string `xml:"http://www.google.com/schemas/sitemap-video/1.1 description"`
ContentLoc string `xml:"http://www.google.com/schemas/sitemap-video/1.1 content_loc"`
PlayerLoc string `xml:"http://www.google.com/schemas/sitemap-video/1.1 player_loc"`
Duration *int `xml:"http://www.google.com/schemas/sitemap-video/1.1 duration"`
ExpirationDate *LastModTime `xml:"http://www.google.com/schemas/sitemap-video/1.1 expiration_date"`
Rating *float32 `xml:"http://www.google.com/schemas/sitemap-video/1.1 rating"`
ViewCount *int `xml:"http://www.google.com/schemas/sitemap-video/1.1 view_count"`
PublicationDate *LastModTime `xml:"http://www.google.com/schemas/sitemap-video/1.1 publication_date"`
FamilyFriendly string `xml:"http://www.google.com/schemas/sitemap-video/1.1 family_friendly"`
Restriction *VideoRestriction `xml:"http://www.google.com/schemas/sitemap-video/1.1 restriction"`
Platform *VideoPlatform `xml:"http://www.google.com/schemas/sitemap-video/1.1 platform"`
RequiresSubscription string `xml:"http://www.google.com/schemas/sitemap-video/1.1 requires_subscription"`
Uploader *VideoUploader `xml:"http://www.google.com/schemas/sitemap-video/1.1 uploader"`
Live string `xml:"http://www.google.com/schemas/sitemap-video/1.1 live"`
Tags []string `xml:"http://www.google.com/schemas/sitemap-video/1.1 tag"`
}
Video is a structure of <video:video> in <url>, per the Google Video Sitemap extension. Reference: https://developers.google.com/search/docs/crawling-indexing/sitemaps/video-sitemaps
type VideoPlatform ¶ added in v0.8.0
type VideoPlatform struct {
Relationship string `xml:"relationship,attr"`
Value string `xml:",chardata"`
}
VideoPlatform is a structure of <video:platform> in <video:video>. It captures the element text and the required "relationship" attribute.
type VideoRestriction ¶ added in v0.8.0
type VideoRestriction struct {
Relationship string `xml:"relationship,attr"`
Value string `xml:",chardata"`
}
VideoRestriction is a structure of <video:restriction> in <video:video>. It captures the element text and the required "relationship" attribute.
type VideoUploader ¶ added in v0.8.0
VideoUploader is a structure of <video:uploader> in <video:video>. It captures the uploader name and the optional "info" URL attribute.
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
advanced
command
|
|
|
atom
command
|
|
|
context
command
|
|
|
encoding
command
|
|
|
errors
command
|
|
|
follow
command
|
|
|
getrandomurls
command
|
|
|
geturls
command
|
|
|
hreflang
command
|
|
|
httpclient
command
|
|
|
image
command
|
|
|
maxconcurrency
command
|
|
|
maxdepth
command
|
|
|
maxresponsesize
command
|
|
|
maxsitemaps
command
|
|
|
maxurls
command
|
|
|
multithread
command
|
|
|
news
command
|
|
|
redirect
command
|
|
|
reuse
command
|
|
|
rss
command
|
|
|
rules
command
|
|
|
simple
command
|
|
|
strict
command
|
|
|
text
command
|
|
|
tolerant
command
|
|
|
video
command
|