{"id":22769791,"url":"https://github.com/bfontaine/gostruct","last_synced_at":"2025-03-30T11:29:56.376Z","repository":{"id":32198116,"uuid":"35771734","full_name":"bfontaine/gostruct","owner":"bfontaine","description":"populate Go structs from webpages using CSS selectors","archived":false,"fork":false,"pushed_at":"2015-07-17T20:43:06.000Z","size":152,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-23T23:43:40.606Z","etag":null,"topics":["go","library","scrapping"],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/bfontaine/gostruct","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bfontaine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-17T15:39:30.000Z","updated_at":"2025-01-28T19:37:19.000Z","dependencies_parsed_at":"2022-08-24T07:40:48.693Z","dependency_job_id":null,"html_url":"https://github.com/bfontaine/gostruct","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfontaine%2Fgostruct","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfontaine%2Fgostruct/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfontaine%2Fgostruct/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bfontaine%2Fgostruct/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bfontaine","download_url":"https://codeload.github.com/bfontaine/gostruct/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246313203,"owners_count":20757446,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","library","scrapping"],"created_at":"2024-12-11T15:15:48.138Z","updated_at":"2025-03-30T11:29:56.344Z","avatar_url":"https://github.com/bfontaine.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gostruct\n\n[![GoDoc](https://godoc.org/github.com/bfontaine/gostruct?status.svg)](https://godoc.org/github.com/bfontaine/gostruct)\n[![Build Status](https://travis-ci.org/bfontaine/gostruct.svg?branch=master)](https://travis-ci.org/bfontaine/gostruct)\n\n**gostruct** populates Go `struct`s from webpages using CSS selectors.\n\n[goquery]: https://github.com/PuerkitoBio/goquery\n\n## Install\n\n    go get github.com/bfontaine/gostruct\n\n## Usage\n\n```go\ntype MyStruct struct {\n    Title string `gostruct:\"#a-selector\"`\n    Desc  string `gostruct:\"h1 .another .one\"`\n}\n\nvar ms MyStruct\n\ngostruct.Fetch(\u0026ms, \"http://www.example.com\")\n```\n\n**gostruct** supports all standard CSS selectors. Additionally, you can end a\nselector with `/foo` to get the `foo` attribute on the selected element. This\nworks only on simple values (i.e. not on slices nor structs).\n\n## Example\n\nThe example program below searchs for \"golang\" on Google and prints the top\nresults.\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"os\"\n\n    \"github.com/bfontaine/gostruct\"\n)\n\ntype Result struct {\n    Title       string `gostruct:\"h3.r\"`\n    Website     string `gostruct:\".kv cite\"`\n    Description string `gostruct:\".st\"`\n}\n\ntype Search struct {\n    Results []Result `gostruct:\"#search li.g\"`\n}\n\nfunc main() {\n    var s Search\n\n    err := gostruct.Fetch(\u0026s, \"https://www.google.com/search?q=golang\u0026hl=en\")\n    if err != nil {\n        fmt.Printf(\"Error: %v\\n\", err)\n        os.Exit(1)\n    }\n\n    for _, r := range s.Results {\n        fmt.Printf(\"%s (%s) - %s\\n\", r.Title, r.Website, r.Description)\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbfontaine%2Fgostruct","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbfontaine%2Fgostruct","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbfontaine%2Fgostruct/lists"}