Documentation ¶
Overview ¶
Package sydsvenskan searches sydsvenskan.se
Index ¶
Constants ¶
View Source
const ( ResultsPath = "//div[starts-with(@class, 'teaser ')]" LinkPath = "//a[contains(@class, 'teaser__text-link')]/@href" HeadingPath = "//h2[contains(@class, 'teaser__heading')]" PreamblePath = "//h2[contains(@class, 'teaser__heading')]/following-sibling::div[contains(@class, 'teaser__preamble')]" PremiumPath = ".[contains(@class, 'teaser--premium')]" ImagePath = "//img/@data-src" PaginationPath = "//*[starts-with(@class, 'pagination')]/a[contains(@class, 'pagination__link--next')]/@href" )
XPaths for getting search result data
View Source
const SearchURLTemplate = "https://www.sydsvenskan.se/sok?q=%s"
SearchURLTemplate is the URL for the search query
Variables ¶
View Source
var BaseURL, _ = url.Parse("https://www.sydsvenskan.se/")
BaseURL is the URL base for all URLs
View Source
var DatePathSegment = regexp.MustCompile(`\d\d\d\d-\d\d-\d\d`)
DatePathSegment is the regexp for date in the URL Path
Functions ¶
Types ¶
type Teaser ¶ added in v1.0.2
type Teaser struct {}
Teaser is a search result
func (*Teaser) ParseImage ¶ added in v1.0.3
ParseImage extracts the image URL
func (*Teaser) ParsePreamble ¶ added in v1.0.3
ParsePreamble extract the text immediately after the heading
func (*Teaser) ParsePremium ¶ added in v1.0.3
ParsePremium extracts premium flag
func (*Teaser) ParseTitle ¶ added in v1.0.3
ParseTitle extract the title
Click to show internal directories.
Click to hide internal directories.