{"id":13414025,"url":"https://github.com/PaulRosset/go-hacknews","last_synced_at":"2025-03-14T20:30:55.564Z","repository":{"id":57495798,"uuid":"99963255","full_name":"PaulRosset/go-hacknews","owner":"PaulRosset","description":"📟  Tiny utility Go client for HackerNews API.","archived":false,"fork":false,"pushed_at":"2017-08-15T07:51:32.000Z","size":25,"stargazers_count":17,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-12-31T04:02:41.588Z","etag":null,"topics":["api","golang","hackernews","hackernews-api","sdk"],"latest_commit_sha":null,"homepage":"","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/PaulRosset.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":"2017-08-10T20:44:02.000Z","updated_at":"2023-12-29T07:32:15.000Z","dependencies_parsed_at":"2022-08-28T20:01:55.574Z","dependency_job_id":null,"html_url":"https://github.com/PaulRosset/go-hacknews","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulRosset%2Fgo-hacknews","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulRosset%2Fgo-hacknews/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulRosset%2Fgo-hacknews/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaulRosset%2Fgo-hacknews/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PaulRosset","download_url":"https://codeload.github.com/PaulRosset/go-hacknews/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243642047,"owners_count":20323952,"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":["api","golang","hackernews","hackernews-api","sdk"],"created_at":"2024-07-30T20:01:55.578Z","updated_at":"2025-03-14T20:30:55.256Z","avatar_url":"https://github.com/PaulRosset.png","language":"Go","funding_links":[],"categories":["Third-party APIs","第三方API","第三方api","\u003cspan id=\"第三方api-third-party-apis\"\u003e第三方API Third-party APIs\u003c/span\u003e","第三方API`第三方API 汇总`","Utility"],"sub_categories":["Utility/Miscellaneous","查询语","实用程序/Miscellaneous","Advanced Console UIs","HTTP Clients","交流","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e","Fail injection"],"readme":"# go-hacknews \n[![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://github.com/ellerbrock/open-source-badge/)\n[![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/avelino/awesome-go)\n[![Travis](https://img.shields.io/travis/rust-lang/rust.svg)](https://travis-ci.org/PaulRosset/go-hacknews)\n[![Go Report Card](https://goreportcard.com/badge/github.com/PaulRosset/go-hacknews)](https://goreportcard.com/report/github.com/PaulRosset/go-hacknews)\n[![](https://cover.run/go/github.com/PaulRosset/go-hacknews.svg)](https://cover.run/go/github.com/PaulRosset/go-hacknews)\n[![](http://godoc.org/github.com/PaulRosset/go-hacknews?status.svg)](http://godoc.org/github.com/PaulRosset/go-hacknews)\n[![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php)\n\n\nTiny utility Go client for HackerNews API.\n\n[Official Hackernews API](https://github.com/HackerNews/API)\n\n## Install\n\n```\n go get github.com/PaulRosset/go-hacknews\n```\n\n## Usage\n\nFew examples are available inside the **examples/** folder.\n\n```go\npackage main\n\nimport (\n\t    \"fmt\"\n\t    \"github.com/PaulRosset/go-hacknews\"\n)\n\nfunc main() {\n\n\t// Init struct with the kind of story you want\n\t// (topstories/newstories/beststories/askstories/showstories/jobstories)\n\t// and the number of posts that you want to fetch.\n\tinit := hacknews.Initializer{\"topstories\", 10}\n\n\t// Get the code of posts.\n\t// Return a slice of int with the entry id if everything is ok or return an error.\n\tcodes, err := init.GetCodesStory()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\t// Get the posts thanks their id fetched above.\n\t// Return a slice of Post type with a readable format in go or return an err if fail.\n\tposts, err := init.GetPostStory(codes)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\t// Iterate over the slice to get what we want.\n\t// Here, get Title and Url of post. But we can access all fields from the official hackernews api\n\t// Note : Field are empty, if no data belong to them\n\tfor _, post := range posts {\n\t\tfmt.Printf(\"Title : %v // Url : %v\\n\", post.Title ,post.Url)\n\t}\n\n}\n\n\n\n```\n\n## Test\n\nTests are available :\n\n```\n$ go test\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPaulRosset%2Fgo-hacknews","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPaulRosset%2Fgo-hacknews","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPaulRosset%2Fgo-hacknews/lists"}