lewisdonovan / google-news-scraper

Lightweight scraper for Google News
Other
233 stars 61 forks source link

i try to use but i have error #62

Open pingplass123 opened 4 hours ago

pingplass123 commented 4 hours ago
TypeError: (0 , google_news_scraper_1.default) is not a function

and this is my code

      import googleNewsScraper from 'google-news-scraper';

      const articles = await googleNewsScraper({ searchTerm: "The Oscars" }); 
      return articles;

by the i use nestjs typescript

pingplass123 commented 3 hours ago

any solution for this issue? @lewisdonovan

lewisdonovan commented 2 hours ago

I can't replicate your issue. I've created a minimum example in this repo: https://github.com/lewisdonovan/gns-example If you pull this repo and run it locally (see the instructions in the README file) does it work for you?

If so, there's likely something wrong with your setup. Providing a minimum example of your non-working code will help me to identify the issue for you.

If the minimum example I've provided doesn't work, then it's likely an incompatibility with your environment. If you can share details of what system/server environment you're running this on, I can help you to find the issue.

pingplass123 commented 2 hours ago

this repo: https://github.com/lewisdonovan/gns-example is working but my project is using nestjs so i use this for api getting news and then response back

lewisdonovan commented 1 hour ago

Ok, great that we've narrowed that down. So now if you can provide a minimum reproducible example?

Providing a minimum example of your non-working code will help me to identify the issue for you.

☝️