Skip to content

Releases: typicalninja/google-sr

[email protected]

16 Sep 15:31
3ddd2e7
Compare
Choose a tag to compare

What's Changed

Major Changes

  • 563bfc4: Update dictionary selectors with accurate definitions (@typicalninja in #28)

    This uses the updated dictionary definitions from google-sr-selectors as a response to google updating their result structure.

    Previously, dictionary definitions were returned as a [string, string]. Now, they are returned as an object with the following properties:

    interface DictionaryDefinition {
      partOfSpeech: string;
      definition: string;
      example: string;
      synonyms: string[];
    }

    Please take steps to update your code to use the new dictionary definition structure.

  • c332095: Rewrite the api to be customizable (@typicalninja in #15/#32)

    google-sr has been completely rewritten to be more customizable. It is possible to create your own selector functions and use them to scrape the data you want.

    filterResults option was replaced by resultTypes which accepts a function instead of a string. This allows you to add your own custom selectors to be used as a parser.

    search({
    -      filterResults: [ResultTypes.SearchResult]
    +      resultTypes: []
    })

    Check the newly added api documentation here

Minor Changes

  • 5676a7a: Support custom selectors (@typicalninja in #33)

    Use the new ResultNodeTyper to create a custom node, and use the ResultSelector to create a function that will parse the raw html for results and return a node.

    import { ResultNodeTyper, ResultSelector } from "google-sr";
    // first argument is the "type" value (string) of the node, second is all the properties of the node
    type DidYouKnow = ResultNodeTyper<
      "SOMETYPE",
      "prop1" | "prop2"
    > & // properties that are not string can be defined as this
    { descriptions: string[] };
    const selector: ResultSelector<DidYouKnow> = ($, strictSelector) => {
      // return node
    };
    
    search({ resultTypes: [selector] });
  • d98c496: Remove uneeded top level options (@typicalninja in #37)

    Removed the safemode top-level options as the same result can be achieved using the requestConfig option.

    const queryResult = await search({
    -    safemode: true,
        // requestConfig is of type AxiosRequestConfig
    +    requestConfig: {
    +		params: {
    +            // enable "safe mode"
    +			safe: 'active'
    +		},
    +	},
    });

Full Changelog: https://github.com/typicalninja/google-sr/blob/master/packages/google-sr/CHANGELOG.md

Release v3.3.1

07 Jun 05:11
Compare
Choose a tag to compare

What's Changed

  • Fixed google-sr package publishing bug, where pnpm did not set package version for a workspace package. reported in #13

Full Changelog: v3.3.0...v3.3.1

Release v3.3.0

02 May 17:50
0feffe8
Compare
Choose a tag to compare

What's Changed

Full Changelog: v3.2.1...v3.3.0

Release patch v3.2.1

11 Sep 02:46
Compare
Choose a tag to compare

Selector patches

Patches link selectors in google-sr-selectors
commit: bb84456

Version updates

Full Changelog: v3.1.0...v3.2.1

Release 3.1.0 (minor)

17 Aug 04:23
Compare
Choose a tag to compare

What's Changed

Full Changelog: v3.0.0...v3.1.0
Install the latest "minor" release: https://www.npmjs.com/package/google-sr

Release 3.0.0

10 Aug 10:02
Compare
Choose a tag to compare

After I sort of abandoned this project last year, its back!!! all selectors have been updated and now search results are being successfully scraped again. new website is also launched

Full Changelog: https://github.com/typicalninja493/google-sr/commits/v3.0.0