huchenme / github-trending-api

:octocat: The missing APIs for GitHub trending projects and developers 📈
https://ghapi.huchen.dev/
MIT License
758 stars 107 forks source link

Export the scraping functions in the utils dir #140

Closed omarryhan closed 3 years ago

omarryhan commented 3 years ago

After your API has been taken down, I tried calling other APIs provided by the good people who offered them for free. Unfortunately, I've had troubles with them and want something more sustainable.

I installed the npm package of this repo thinking that the fetchRepositories function would be the function that does the scraping. Instead, it's the function that calls your API directly which as you know, is currently not working.

I can work on exposing the scraping functions directly instead of the current functions that call your API first. Just thought I'd get your opinion on it first. Should it replace the existing functions? Should the scraping functions be exported using a different name? Should they not be exported at all?

huchenme commented 3 years ago

thanks Omar, I guess it will work but it will be unusable as the scraping will take a few seconds to get a response, it will be better to have caching in the server.

omarryhan commented 3 years ago

Thanks for the quick response :)

I wasn't intending on using it in the browser, rather in a serverless function. More specifically in a Next.js function on Vercel, by using it in the /api directory.

I still haven't looked into how to handle caching on a Next.JS function response though. But I plan on caching all responses for atleast one day.

omarryhan commented 3 years ago

Here's what I meant: https://github.com/huchenme/github-trending-api/pull/142

I can also work on adding a Typescript type declaration file. Let me know if you're open for that.