# vid_data

> Get youtube channel, video or playlist information

Latest version **1.0.0** (published 2019-08-02) · UNLICENSED license · 0 weekly downloads

## Install

```sh
npm install vid_data
pnpm add vid_data
yarn add vid_data
bun add vid_data
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-08-02 |
| First published | 2018-12-29 |
| Weekly downloads | 0 |
| License | UNLICENSED |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 30.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | dxwc |
| Maintainers | dxwc |
| Keywords | youtube, video, channel, id, data |

## Links

- npm: https://www.npmjs.com/package/vid_data
- Repository: https://github.com/dxwc/vid_data
- Homepage: https://github.com/dxwc/vid_data#readme
- Issues: https://github.com/dxwc/vid_data/issues
- npm.io page: https://npm.io/package/vid_data

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2019-08-02
- 0.3.1 — 2019-01-26
- 0.3.0 — 2019-01-16
- 0.2.0 — 2019-01-03
- 0.1.2 — 2018-12-29
- 0.1.1 — 2018-12-29
- 0.1.0 — 2018-12-29
- 0.0.0 — 2018-12-29

## README

<p align='center'>
    <img src="https://nodei.co/npm/vid_data.png">
</p>
<p align='center'>
    <img src='https://img.shields.io/david/dxwc/vid_data.svg?style=for-the-badge'>
    <img src='https://img.shields.io/npm/dt/vid_data.svg?style=for-the-badge'>
</p>

## get_video_id(url)

_Given Youtube video URL, returns video id_

Parameter :

+ `url` : A youtube video watch URL as string. Supported URL format example :
    + `https://www.youtube.com/watch?...`
    + `https://m.youtube.com/watch?...`
    + `https://youtu.be/...`
    + `https://www.youtube.com/embed/...`
    + `https://www.youtube-nocookie.com/embed/...`

Returns :

+ A string containing video id, or
+ null

## get_channel_id(url, offline, print_error)

_Given Youtube channel, video or user URL, returns channel id_

Parameters :

+ `url` :  A youtube video watch, channel or user URL as string. Supported URL format
  example :
    + `https://www.youtube.com/channel/...`
    + `https://www.youtube.com/user/...`
    + `https://www.youtube.com/watch?...`
    + `https://m.youtube.com/watch?...`
    + `https://youtu.be/...`
    + `https://www.youtube.com/embed/...`
    + `https://www.youtube-nocookie.com/embed/...`
+ `offline` : An optional boolean argument to indicate whether or not to make HTTP
  request to get channel ID.
    + Default is false, which makes a single HTTP request to `https://www.youtube.com/watch?...` or `https://www.youtube.com/user/...` URL.
    + Setting it to true would return null to all URL other than those formatted like this `https://www.youtube.com/channel/...`
+ `print_error` : An optional boolean argument to indicate whether or not to print
   any possible error message to console. Only useful for debugging. Default false.

Returns :

+ A promise that resolves a string containing channel ID or,
+ A promise that resolves null

## is_valid_to_get_channel_id(url)

_Given a URL, returns a Boolean indicating whether or not it is valid URL to get_
_channel id_

Parameter :

+ `url` :  Any type

Returns :

+ True if `url` is one of the valid format to get channel ID information
    + See get_channel_id() above for URL formats that are considered valid
+ False if `url` is not one of the valid format

## get_playlist_id(url)

_Given a playlist URL, returns the playlist's ID_

Parameter :

+ `url` :  A youtube account user created playlist URL. Supported url format example:
    + `https://www.youtube.com/playlist?list=...`
    + `https://m.youtube.com/playlist?list=...`
    + `https://www.youtube.com/watch?v=naHNhDHK4VU&list=...`
    + `https://m.youtube.com/watch?v=naHNhDHK4VU&list=...`

Returns :

+ A string containing playlist ID, or
+ null

## get_playlist_videos(url, offline, print_error)

_Given playlist URL, returns an ordered array of playlist video IDs_

Parameters :

+ `url` : A youtube account user created or custom playlist URL. Supported url format
  example:
    + `https://www.youtube.com/playlist?list=...`
    + `https://m.youtube.com/playlist?list=...`
    + `https://www.youtube.com/watch?v=naHNhDHK4VU&list=...`
    + `https://m.youtube.com/watch?v=naHNhDHK4VU&list=...`
    + `https://www.youtube.com/embed/naHNhDHK4VU?playlist=...,...,...`
+ `offline` : An optional boolean argument to indicate whether or not to make HTTP
  request to get channel ID.
    + Default is false (makes HTTP request). Note that only URLs formatted as
    `https://www.youtube.com/embed/naHNhDHK4VU?playlist=...,...,...` are parsable
    offline
+ `print_error` : An optional boolean argument to indicate whether or not to print
   any possible error message to console. Only useful for debugging. Default false.

Returns :

+ A promise that resolves a non-empty array of ordered video IDs of the playlist
    + The maximum length of this array is currently 100
+ If invalid, error, or not parsable, returns a promise that resolves null

## get_channel_id_and_name(url)

Given a video/video shortcut/embed/channel/user `url`, makes a single HTTP request and
returns an object containing keys `channel_id` and `channel_name` with string values.
On error or invalid url, returns null.

NOTE: this function is comparatively more susceptible to break on changes.

---

This software was not produced by or directly for YouTube, LLC and has no affiliation
with the LLC. Use this software only at your own volition.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

---
_Source: https://npm.io/package/vid_data · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
