3.8.4 • Published 9 months ago

ytsr v3.8.4

Weekly downloads
7,911
License
MIT
Repository
github
Last release
9 months ago

node-ytsr

NPM version NPM downloads codecov Known Vulnerabilities Discord

Simple js only package to search for Youtube for Videos, Playlists and many more. Does not require any login or Google-API-Key.

Support

You can contact us for support on our chat server

Usage

const ytsr = require('ytsr');

const searchResults = await ytsr('github');

API

ytsr(searchString, options)

Searches for the given string

  • searchString
    • search string or url (from getFilters) to search from
  • options

    • object with options
    • possible settings:
    • glString -> 2-Digit Code of a Country, defaults to US - Allows for localisation of the request
    • hlString -> 2-Digit Code for a Language, defaults to en - Allows for localisation of the request
    • safeSearchBoolean -> pull items in youtube restriction mode.
    • limitinteger -> limits the pulled items, defaults to 100, set to Infinity to get the whole list of search results - numbers <1 result in the default being used
    • pagesNumber -> limits the pulled pages, pages contain 20-30 items, set to Infinity to get the whole list of search results - numbers <1 result in the default limit being used - overwrites limit
    • requestOptionsObject -> Additional parameters to passed to miniget, which is used to do the https requests
  • returns a Promise

  • Example response

ytsr.getFilters(searchString, options)

Pulls avaible filters for the given string or link

Usage

const ytsr = require('ytsr');

const filters1 = await ytsr.getFilters('github');
const filter1 = filters1.get('Type').get('Video');
const filters2 = await ytsr.getFilters(filter1.url);
const filter2 = filters2.get('Features').get('Live');
const options = {
  pages: 2,
}
const searchResults = await ytsr(filter2.url, options);
  • searchString
    • string to search for
    • or previously optained filter ref
  • options
    • glString -> 2-Digit Code of a Country, defaults to US - Allows for localisation of the request
    • hlString -> 2-Digit Code for a Language, defaults to en - Allows for localisation of the request
    • requestOptionsObject -> Additional parameters to passed to miniget, which is used to do the https requests
  • returns a Promise resulting in a Map<String, Map<String, Filter>>
  • Example response

ytsr.continueReq(continuationData)

Continues a previous request by pulling yet another page.
The previous request had to be done using pages limitation.

Usage

const ytsr = require('ytsr');

const firstResultBatch = await ytsr('github', { pages: 1 });
const secondResultBatch = ytsr.continueReq(firstResultBatch.continuation);
const thirdResultBatch = ytsr.continueReq(secondResultBatch.continuation);

// You can now use the .items property of all result batches e.g.:
console.log(firstResultBatch.items);
console.log(secondResultBatch.items);
console.log(thirdResultBatch.items);
  • returns a Promise resolving into { continuation, items }

Related / Works well with

Install

npm install --save ytsr

License

MIT

3.8.4

9 months ago

3.8.3

9 months ago

3.8.2

1 year ago

3.8.1

1 year ago

3.8.0

2 years ago

3.7.0

2 years ago

3.6.0

2 years ago

3.5.3

3 years ago

3.5.2

3 years ago

3.5.1

3 years ago

3.5.0

3 years ago

3.4.1

3 years ago

3.4.0

3 years ago

3.3.1

3 years ago

3.3.0

3 years ago

3.2.4

3 years ago

3.2.3

3 years ago

3.2.2

3 years ago

3.2.1

3 years ago

3.2.0

3 years ago

3.0.0

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

2.0.0-alpha.4

3 years ago

2.0.0-alpha.3

3 years ago

2.0.0-alpha.2

3 years ago

2.0.0-alpha.1

3 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.1.21

4 years ago

0.1.20

4 years ago

0.1.19

4 years ago

0.1.17

4 years ago

0.1.18

4 years ago

0.1.16

4 years ago

0.1.15

4 years ago

0.1.14

4 years ago

0.1.13

4 years ago

0.1.12

4 years ago

0.1.11

4 years ago

0.1.10

4 years ago

0.1.9

5 years ago

0.1.8

6 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

7 years ago

0.1.3

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.1

7 years ago