Yeah, specifically with newsapi.org, seems like since 22 May 2020 they changed the liberties of the free developer keys and now they reject any request using that key that is not coming from localhost. You need to buy one of the keys intended for projects on production.
As for me, since it was just a school project I just put my site on production and deployed locally. As long as the page is in localhost the free version still works.
Some people recommend passing the requests through your backend/server but I don’t know how that works.