'How to get access to data in Github Repo with Nodejs Express

I'm currently trying to get COVID-19 from the Covid Data Repository by Johns Hopkins. https://github.com/CSSEGISandData/COVID-19

The repo get updated with new data every 24h, and they upload the data in .csv files daily.

My question would be: How to get access to the latest data from my Web App with Nodejs? Scraping or there's an easy way that I'm missing?

MERN Stack



Solution 1:[1]

Github API might be of some help here but there seems to be no way you can read the contents modified through a commit. However, you verify which file is modified in a commit. Using this name, you can render the raw file in a browser which might be easier to read in CSV format.

https://developer.github.com/v3/repos/commits/ https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_daily_reports/04-06-2020.csv

Solution 2:[2]

You are missing out the easy way. you can retrieve the csv files easily with superface sdk by iterating the day as the filename. For example - lets retrieve 01-01-2021.csv

npm install @superfaceai/one-sdk

npx @superfaceai/cli install vcs/single-file-content

const { SuperfaceClient } = require("@superfaceai/one-sdk");

const sdk = new SuperfaceClient();

async function run() {
  // Load the installed profile
  const profile = await sdk.getProfile("vcs/single-file-content");

  // Use the profile
  const result = await profile.getUseCase("SingleFileContent").perform({
    owner: "CSSEGISandData",
    repo: "COVID-19",
    path: "csse_covid_19_data/csse_covid_19_daily_reports/01-01-2021.csv",
    ref: "1f0e048",
  });

  console.log(result.unwrap());
}

run();

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Raju
Solution 2 henok