https://github.com/f0rr0/youtuber
Search YouTube with Levenshtein distances
https://github.com/f0rr0/youtuber
levenshtein-distance ramda songs youtube youtube-api
Last synced: 10 months ago
JSON representation
Search YouTube with Levenshtein distances
- Host: GitHub
- URL: https://github.com/f0rr0/youtuber
- Owner: f0rr0
- License: mit
- Created: 2016-05-24T10:11:53.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-08-05T02:03:48.000Z (almost 8 years ago)
- Last Synced: 2025-08-30T00:38:41.357Z (10 months ago)
- Topics: levenshtein-distance, ramda, songs, youtube, youtube-api
- Language: JavaScript
- Homepage:
- Size: 18.6 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
## YouTuber
Search Youtube for songs based on title and artist. Get the best match based on Levenshtein distances.
### Usage
```
npm i -S youtuber
```
The module exports a default curried function that takes 3 arguments namely: `api_key` string, the `callback` function and a `track` object with at least two keys (`title` and `artist`). The callback function is passed two arguments namely: `err` (if any or null) and the `youtubed track` (if successful or the track as is). The youtubed track has two new keys namely the `youtube_link` and the `youtube_images` object.
```javascript
import youtuber from 'youtuber';
const client = youtuber('YOUR_API_KEY');
const random_track = {
title: "R U Mine?",
artist: "Arctic Monkeys"
};
const log = (err, track) => {
if (err) {
console.error(err);
}
else console.log(track);
};
client(log, random_track);
// { title: 'R U Mine?',
// artist: 'Arctic Monkeys',
// youtube_images:
// { default:
// { url: 'https://i.ytimg.com/vi/ngzC_8zqInk/default.jpg',
// width: 120,
// height: 90 },
// medium:
// { url: 'https://i.ytimg.com/vi/ngzC_8zqInk/mqdefault.jpg',
// width: 320,
// height: 180 },
// high:
// { url: 'https://i.ytimg.com/vi/ngzC_8zqInk/hqdefault.jpg',
// width: 480,
// height: 360 } },
// youtube_link: 'https://www.youtube.com/watch?v=ngzC_8zqInk'
// }
```
##### Do listen to the song [https://www.youtube.com/watch?v=ngzC_8zqInk](https://www.youtube.com/watch?v=ngzC_8zqInk)
### Develop
```
git clone https://github.com/sidjain26/youtuber/
cd youtuber
npm i
npm run build
npm run test
```