# get-artist-title

> Get the artist and title from a string, eg. a YouTube video title

Latest version **1.3.1** (published 2021-02-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install get-artist-title
pnpm add get-artist-title
yarn add get-artist-title
bun add get-artist-title
```

Provides the command `format-artist-title`.

## 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.3.1 |
| Published | 2021-02-02 |
| First published | 2016-01-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 38.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 34 |
| Author | Renée Kooi |
| Maintainers | goto-bus-stop |

## Links

- npm: https://www.npmjs.com/package/get-artist-title
- Repository: https://github.com/goto-bus-stop/get-artist-title
- Issues: https://github.com/goto-bus-stop/get-artist-title/issues
- npm.io page: https://npm.io/package/get-artist-title

## Dependencies (2)

- [audio-extensions](https://npm.io/package/audio-extensions.md) 0.0.0
- [video-extensions](https://npm.io/package/video-extensions.md) ^1.1.0

## Recent versions

- 1.3.1 (latest) — 2021-02-02
- 1.3.0 — 2020-02-29
- 1.2.0 — 2019-12-08
- 1.1.1 — 2018-06-08
- 1.1.0 — 2018-05-17
- 1.0.0 — 2017-02-16
- 0.4.1 — 2017-01-25
- 0.4.0 — 2017-01-09
- 0.3.0 — 2016-04-20
- 0.2.1 — 2016-04-06
- 0.2.0 — 2016-04-02
- 0.1.0 — 2016-03-26
- 0.0.3 — 2016-01-27
- 0.0.2 — 2016-01-25
- 0.0.1 — 2016-01-25

## README

# get-artist-title

[![travis](https://img.shields.io/travis/goto-bus-stop/get-artist-title.svg?style=flat-square)](https://travis-ci.org/goto-bus-stop/get-artist-title)
[![npm](https://img.shields.io/npm/v/get-artist-title.svg?style=flat-square)](https://npmjs.com/package/get-artist-title)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](http://standardjs.com/)

Get the artist and title from a full song name, eg. a YouTube video title.

## Installation

```bash
npm install --save get-artist-title
```

## Usage

### CLI

```bash
$ npm install --global get-artist-title

$ format-artist-title

Usage
  $ format-artist-title <input>

Example
  $ format-artist-title "Ga-In (가인) - Nostalgia (노스텔지아) - Lyrics [Hangul+Translation] .mov"
  Ga-In (가인) – Nostalgia (노스텔지아)

```

### JavaScript

```js
const getArtistTitle = require('get-artist-title')
getArtistTitle('Taylor Swift - Out Of The Woods')
//→ ['Taylor Swift', 'Out Of The Woods']

let [ artist, title ] = getArtistTitle('FEMM - PoW! (Music Video)')
//→ ['FEMM', 'PoW!']
```

## API

### getArtistTitle(string, options={})

Extract the artist and title from `string`. Returns an Array with two elements,
`[artist, title]`, or `null` if no artist/title can be found.

Possible `options` are:

  - `defaultArtist` - Artist name to use if an artist name/song title pair can't
    be extracted. The input string, minus any cruft, will be used as the song
    title.
  - `defaultTitle` - Song title to use if an artist name/song title pair can't
    be extracted. The input string, minus any cruft, will be used as the artist
    name.

It's useful to provide defaults if you're passing strings from an external
service. For example, a YouTube video title may not always contain the artist
name, but the name of the channel that uploaded it might be relevant.

```js
const [ artist, title ] = getArtistTitle('[MV] A Brand New Song!', {
  defaultArtist: 'Channel Name'
})
// → ['Channel Name', 'A Brand New Song!']
```

```js
// Assuming `video` is a Video resource from the YouTube Data API:
const [ artist, title ] = getArtistTitle(video.snippet.title, {
  defaultArtist: video.snippet.channelTitle
})
```

## Licence

[MIT](./LICENSE)

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