Skip to content

Commit

Permalink
Update docs and actions for v2.
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisdonovan committed Oct 27, 2024
1 parent c3b4138 commit 9ccd5c9
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Release
on:
push:
branches:
- main
- master
jobs:
release:
runs-on: ubuntu-latest
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
# google-news-scraper CHANGELOG
All notable changes to this project will be documented in this file.

## [2.0.0] - 2024-10-27

To update please run `npm update google-news-scraper`

### Changed

- Added support for both ESM and CJS.
- Added TypeScript support.
- Integrated Rollup to make shipping easier.
- Added release action, to bump version and ship to NPM every time we push to `master` branch`.

## [1.2.2] - 2024-03-18

To update please run `npm update google-news-scraper`
Expand Down
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ A lightweight package that scrapes article data from [Google News](https://news.
* [Usage](#usage-%EF%B8%8F)
* [Output](#output-)
* [Config](#config-%EF%B8%8F)
* [TypeScript](#typescript-)
* [CommonJS](#common-js-)
* [Performance](#performance-)
* [Upkeep](#upkeep-)
* [Bugs](#bugs-)
Expand All @@ -30,7 +32,7 @@ yarn add google-news-scraper
## Usage 🕹️
Simply import the package and pass a config object.
```javascript
const googleNewsScraper = require('google-news-scraper');
import googleNewsScraper from 'google-news-scraper';

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

Expand Down Expand Up @@ -145,6 +147,20 @@ Whether or not Puppeteer should run in [headless mode](https://www.browserstack.

Defaults to `true`

## TypeScript 💙
Google News Scraper includes full [TypeScript](https://typescriptlang.org/) definitions.

Your IDE should pick the types up automatically, but if not you can find them in the `dist/tsc/` folder.

## Common JS 👴🏻
Google News Scraper is built to work as an [ESM module](https://nodejs.org/api/esm.html) out of the box, but also works as a [Common JS module](https://nodejs.org/api/modules.html) too, just use `require` instead of `import`:
```javascript
const googleNewsScraper = require('google-news-scraper');

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

```

## Performance 📈
My test query returned 94 results, which took 4.5 seconds with article content and 3.6 seconds without it. I'm on a fibre connection, and other queries may return a different number of results, so your mileage may vary.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "google-news-scraper",
"version": "2.0.0-alpha.7",
"version": "2.0.0",
"description": "Lightweight async scraper for Google News",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.mjs",
Expand Down

0 comments on commit 9ccd5c9

Please sign in to comment.