{"id":13414070,"url":"https://github.com/jellydator/newsapi-go","last_synced_at":"2025-03-14T20:31:07.291Z","repository":{"id":38331112,"uuid":"462471637","full_name":"jellydator/newsapi-go","owner":"jellydator","description":"Go client for NewsAPI","archived":false,"fork":false,"pushed_at":"2024-03-02T09:40:26.000Z","size":33,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-07-31T20:53:21.567Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jellydator.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-22T20:56:15.000Z","updated_at":"2024-04-26T00:11:59.000Z","dependencies_parsed_at":"2022-08-25T03:53:59.809Z","dependency_job_id":"b9884b6f-219f-46d8-9a5f-747f9d651e87","html_url":"https://github.com/jellydator/newsapi-go","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/jellydator%2Fnewsapi-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jellydator%2Fnewsapi-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jellydator%2Fnewsapi-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jellydator%2Fnewsapi-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jellydator","download_url":"https://codeload.github.com/jellydator/newsapi-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243642087,"owners_count":20323954,"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":[],"created_at":"2024-07-30T20:01:56.848Z","updated_at":"2025-03-14T20:31:06.910Z","avatar_url":"https://github.com/jellydator.png","language":"Go","funding_links":[],"categories":["第三方api","Third-party APIs"],"sub_categories":["实用程序/Miscellaneous","Utility/Miscellaneous","Fail injection"],"readme":"# newsapi\n[![GoDoc](https://godoc.org/github.com/jellydator/newsapi-go?status.png)](https://godoc.org/github.com/jellydator/newsapi-go)\n[![Coverage Status](https://coveralls.io/repos/github/jellydator/newsapi-go/badge.svg?branch=master)](https://coveralls.io/github/jellydator/newsapi-go?branch=master)\n[![Go Report Card](https://goreportcard.com/badge/github.com/jellydator/newsapi-go)](https://goreportcard.com/report/github.com/jellydator/newsapi-go)\n\nGo client implementation for the NewsAPI.\n\n## Installation\n```\ngo get github.com/jellydator/newsapi-go\n```\n\n## Usage\nSimply, we create a client using `NewClient` function, by default only an API\nkey is required, however some other parameters can be set using variadic\noption functions.\n```go\nclient := newsapi.NewClient(\"apiKey\", newsapi.WithHTTPClient(\u0026http.Client{\n\tTimeout: 5 * time.Second,\n}))\n```\n\n## Endpoints\n\n### Everything\n`Everything` retrieves all articles based on provided parameters.\nFull endpoint documentation can be viewed [here](https://newsapi.org/docs/endpoints/everything).\n```go\narticles, pageCount, err := client.Everything(context.Background(), newsapi.EverythingParams{\n\tQuery: \"cryptocurrency\",\n})\nif err != nil {\n\t// handle error\n}\n// success\n```\n\n### Top Headlines\n`TopHeadlines` retrieves top headlines articles based on provided parameters.\nFull endpoint documentation can be viewed [here](https://newsapi.org/docs/endpoints/top-headlines).\n```go\narticles, pageCount, err := client.TopHeadlines(context.Background(), newsapi.TopHeadlinesParams{\n\tQuery: \"cryptocurrency\",\n})\nif err != nil {\n\t// handle error\n}\n// success\n```\n\n### Sources\n`Sources` retrieves available sources based on provided parameters.\nFull endpoint documentation can be viewed [here](https://newsapi.org/docs/endpoints/sources).\n```go\nsources, err := client.Sources(context.Background(), newsapi.SourceParams{\n\tCategories: []newsapi.Category{\n\t\tnewsapi.CategoryBusiness,\n\t\tnewsapi.CategoryScience,\n\t},\n})\nif err != nil {\n\t// handle error\n}\n// success\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjellydator%2Fnewsapi-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjellydator%2Fnewsapi-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjellydator%2Fnewsapi-go/lists"}