modulepackage
1.0.0
Repository: https://github.com/ledongthuc/hemnetparser.git
Documentation: pkg.go.dev
# README
Hemnet Parser
Library and a simple commandline to parse information from Hemnet URL to JSON, XML or update it to Google sheet.
Library
Install
go get -u github.com/ledongthuc/hemnetparser
Usage
Parse data to JSON/XML:
func main() {
output, err := hemnetparser.Parse("https://www.hemnet.se/bostad/lagenhet-2rum-bromma-beckomberga-stockholms-kommun-agatvagen-26-16065891")
if err != nil {
panic(err)
}
fmt.Println(output.ToJSON())
fmt.Println(output.ToXML())
}
Parse and update to google sheet:
type Configuration struct {
}
googlesheet.Process(googlesheet.Configuration{
GoogleCredentialPath: "credentials.json" ,
SpreadsheetID : "1S0Xzpl_a3SFGnkFWCw7M1t_NXa2VZV42Lxh70G9PTlo" ,
})
You can check full configuration at: https://github.com/ledongthuc/hemnetparser/blob/master/googlesheet/sheet.go#L32
Commandline
Install
go get -u github.com/ledongthuc/hemnetparser/cmd/hemnet-parser
Usage
Parse data to JSON
hemnet-parser --format=json https://www.hemnet.se/bostad/lagenhet-2rum-bromma-beckomberga-stockholms-kommun-agatvagen-26-16065891
Parse data to XML
hemnet-parser --format=xml https://www.hemnet.se/bostad/lagenhet-2rum-bromma-beckomberga-stockholms-kommun-agatvagen-26-16065891
Parse data and update to Google sheet
hemnet-parser --format=googlesheet --credential=credentials.json --sheet-id=1S0Xzpl_a3SFGnkFWCw7M1t_NXa2VZV42Lxh70G9PTlo --skipheader=1``
credential: Turn on Google Sheet APIs and download credentials.json from https://developers.google.com/sheets/api/quickstart/go
sheet-id: https://developers.google.com/sheets/api/guides/concepts
Before run:
After run:
# Functions
GetFloat64 get value of pointer or empty value.
GetString get value of pointer or empty value.
Parse parses information from URL to output object.
PtrFloat64 get pointer of value float64.
PtrString get pointer of value string.
StringValueOrNil convert empty if it's nil.
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
AreaDetail define area information such as city, county or country.
Output is parsed output from library.
# Type aliases
No description provided by the author