Skip to content

This is a program written in Golang to fetch the top 10 news headlines from NewsAPI. The program was built with Goroutines libery so that it can fetch news from the 5 categories(business, general, science, technology, health) independently and simultaneously.

License

Notifications You must be signed in to change notification settings

yinnyC/Go-News-Headline-Fetcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Top News Headline Fetcher

Go Report Card code size last commit

This is a program written in Golang to fetch the top 10 news headlines from NewsAPI. The program was built with Goroutines libery so that it can fetch news from the 5 categories(business, general, science, technology, health) independently and simultaneously.

Instructions

  • Clone the repo

    git clone https://github.com/yinnyC/MakeUtility.git
  • Configure the environmnet file, and put in your own API Key.

    # change file name
    mv .env.example .env
  • Run the program

    go run main.go

Sample Outcome

Please refer to directories /SampleOutput and there will be two files:

  • topnewsheadlines.json
[
 {
  "category": "science",
  "articles": [
   {
    "title": "Among the Stars chronicles daring space mission to repair physics experiment - Ars Technica",
    "url": "https://arstechnica.com/science/2021/10/among-the-stars-chronicles-daring-space-mission-to-repair-physics-experiment/"
   },
   {
    "title": "NASA reassigns 2 astronauts from Boeing's Starliner to SpaceX's Crew Dragon - Space.com",
    "url": "https://www.space.com/nasa-reassigns-astronauts-boeing-spacex"
   },
   {
    "title": "Burial that included a racy love goddess inscription held multiple people - Livescience.com",
    "url": "https://www.livescience.com/tomb-nestors-cup-multiple-individuals"
   },
   {
    "title": "Creepy New Drone That Walks and Flies Is a Robopocalypse Nightmare Come True - Gizmodo",
    "url": "https://gizmodo.com/creepy-new-drone-that-walks-and-flies-is-a-robopocalyps-1847809268"
   },
   ...
  ]
  • debug-web.log

About

This is a program written in Golang to fetch the top 10 news headlines from NewsAPI. The program was built with Goroutines libery so that it can fetch news from the 5 categories(business, general, science, technology, health) independently and simultaneously.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published