{"id":13612344,"url":"https://github.com/AllToMP3/alltomp3","last_synced_at":"2025-04-13T11:32:00.038Z","repository":{"id":5359802,"uuid":"52100245","full_name":"AllToMP3/alltomp3","owner":"AllToMP3","description":"Node module to download and convert in MP3 with tags an online video","archived":false,"fork":false,"pushed_at":"2022-12-07T17:49:15.000Z","size":499,"stargazers_count":139,"open_issues_count":24,"forks_count":35,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-04-15T00:14:27.992Z","etag":null,"topics":["album","alltomp3","api","conversion","deezer","identification","itunes","lyrics","mp3","playlist","song","songs","spotify","youtube","youtube-video"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AllToMP3.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-19T16:19:49.000Z","updated_at":"2024-04-05T11:21:36.000Z","dependencies_parsed_at":"2023-01-13T13:30:48.543Z","dependency_job_id":null,"html_url":"https://github.com/AllToMP3/alltomp3","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AllToMP3%2Falltomp3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AllToMP3%2Falltomp3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AllToMP3%2Falltomp3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AllToMP3%2Falltomp3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AllToMP3","download_url":"https://codeload.github.com/AllToMP3/alltomp3/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248705736,"owners_count":21148583,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["album","alltomp3","api","conversion","deezer","identification","itunes","lyrics","mp3","playlist","song","songs","spotify","youtube","youtube-video"],"created_at":"2024-08-01T20:00:28.261Z","updated_at":"2025-04-13T11:31:59.730Z","avatar_url":"https://github.com/AllToMP3.png","language":"JavaScript","funding_links":[],"categories":["HarmonyOS","JavaScript"],"sub_categories":["Windows Manager"],"readme":"# alltomp3 [![CircleCI Status](https://circleci.com/gh/AllToMP3/alltomp3.svg?style=shield\u0026circle-token=:circle-token)](https://circleci.com/gh/AllToMP3/alltomp3)\nDownload and convert an online video in MP3 with tags.\n\nProvide several useful methods to get information about a song or to guess the track matching a YouTube video.\n\n## Requirements\n- ffmpeg \u003e= 2.8 with lamemp3;\n- node-acoutstid requirements (https://github.com/parshap/node-acoustid#installation - https://acoustid.org/chromaprint);\n- eyeD3 \u003e= 0.7.10.\n\n## Installation\n```\nnpm install alltomp3\n```\n\n```js\nconst alltomp3 = require('alltomp3');\n\nconst dl = alltomp3.findAndDownload(\"imagine dragons on top of the world\", \"./\", (infos) =\u003e {\n  console.log(\"It's finished: \", infos);\n});\n\n// {\n//   infos: {\n//     title: 'On Top Of The World',\n//     artistName: 'Imagine Dragons',\n//     deezerId: 63510362,\n//     itunesId: 555694746,\n//     position: 5,\n//     duration: 192,\n//     deezerAlbum: 6240279,\n//     discNumber: 1,\n//     album: 'Night Visions',\n//     releaseDate: '2012-01-01',\n//     nbTracks: 13,\n//     genreId: 132,\n//     cover: 'http://e-cdn-images.deezer.com/images/cover/7e8314f4280cffde363547a495a260bc/600x600-000000-80-0-0.jpg',\n//     genre: 'Pop'\n//   },\n//   file: './Imagine Dragons - On Top Of The World.mp3'\n// }\n```\n\n## Methods\n\nEach time a `trackInfos` object is referred, it corresponds to a JavaScript object with the following fields:\n- `title`\n- `artistName`\n- (optional) `album`: name of the album\n- (optional) `cover`: URL of an image for the cover\n- (optional) `position`: position of the track on the album\n- (optional) `nbTracks`: number of tracks on the album\n- (optional) `releaseDate`: format YYYY-MM-YY\n- (optional) `discNumber`: number of the disc where the track is\n- (optional) `genre`: name of the genre\n- (optional) `duration`: duration in second\n- (optional) `deezerId`: ID of the track on Deezer (http://developers.deezer.com/api/track)\n- (optional) `itunesId`: ID of the track on iTunes (https://itunes.apple.com/lookup?id=)\n- (optional) `deezerAlbum`: ID of the album on Deezer (http://developers.deezer.com/api/album)\n- (optional) `genreId`: ID of the genre on Deezer (http://developers.deezer.com/api/genre)\n\n\n### downloadAndTagSingleURL(url, outputFolder, callback, title, verbose)\nDownload, convert and tag the video from `url`. Does not work with playlists, only with single videos.\nThe callback function takes one argument, an object containing the following fields:\n- `file`: the name of the output file\n- `infos`: a `trackInfos` object\n\nIf you are looking for specific query and you think `url` correspond to the song you want, you can help the identification and tags with the `title` argument.\n\n#### Emit\n##### 'download': the download is in progress\nThis event is emitted during the download, with an object containing:\n- `progress`: the percentage of the download\n\n##### 'download-end': the download end\n\n##### 'convert': the conversion is in progress\nThis event is emitted during the conversion, with an object containing:\n- `progress`: the percentage of the conversion\n\n##### 'infos': infos about the track\nThis event is emitted every time new information about the track are found, with a `trackInfos` object.\n\n##### 'end': everything is finished\nThis event is emitted at the end (when the file has been downloaded, converted and tagged) with an object containing the following fields:\n- `file`: the name of the output file\n- `infos`: a `trackInfos` object\n\n### findAndDownload(query, outputFolder, callback, verbose)\nFind a YouTube music video matching the query, download and tag it.\nThe callback function takes two arguments, first is an object containing the following fields:\n- `file`: the name of the output file\n- `infos`: a `trackInfos` object\n\nAnd second is fill with an error message if any.\n\n#### Emit\n##### 'search-end': the search end\n\n##### 'download': the download is in progress\nThis event is emitted during the download, with an object containing:\n- `progress`: the percentage of the download\n\n##### 'download-end': the download end\n\n##### 'convert': the conversion is in progress\nThis event is emitted during the conversion, with an object containing:\n- `progress`: the percentage of the conversion\n\n##### 'infos': infos about the track\nThis event is emitted every time new information about the track are found, with a `trackInfos` object.\n\n```js\nconst alltomp3 = require('alltomp3');\n\nconst dl = alltomp3.findAndDownload(\"imagine dragons on top of the world\", (infos) =\u003e {\n  console.log(\"It's finished: \", infos);\n});\ndl.on('search-end', () =\u003e {\n  console.log('Search end');\n});\ndl.on('download', (infos) =\u003e {\n  process.stdout.cursorTo(0);\n  process.stdout.clearLine(1);\n  process.stdout.write(infos.progress + '%');\n});\ndl.on('download-end', () =\u003e {\n  console.log('', 'Download end');\n});\ndl.on('convert', (infos) =\u003e {\n  process.stdout.cursorTo(0);\n  process.stdout.clearLine(1);\n  process.stdout.write(infos.progress + '%');\n});\ndl.on('convert-end', () =\u003e {\n  console.log('', 'Convert end');\n});\ndl.on('infos', (infos) =\u003e {\n  console.log('New infos received: ', infos);\n});\n```\n\n### findVideo(query, verbose)\nSearch on YouTube the video which should have an audio corresponding to the `query`. It works best if the query contains the artist and the title of the track.\n\nReturns a **Promise** which is resolved with an ordered array of objects containing:\n- `id`: YouTube videoId\n- `url`: URL of the video\n- `title`: title of the video\n- `hd` (boolean): `true` if the quality \u003e= 720p\n- `duration`: duration in seconds\n- `views`: number of views\n- `score`: a high score indicate a high probability of matching with the query. Can be negative\n\n```js\nconst alltomp3 = require('alltomp3');\n\nalltomp3.findVideo(\"imagine dragons on top of the world\").then((results) =\u003e {\n  console.log(results);\n});\n\n// [ { id: 'g8PrTzLaLHc',\n//     url: 'https://www.youtube.com/watch?v=g8PrTzLaLHc',\n//     title: 'Imagine Dragons - On Top of the World -',\n//     hd: false,\n//     duration: 191,\n//     views: '24255381',\n//     score: -42.113922489729575 },\n//   { id: 'e74VMNgARvY',\n//     url: 'https://www.youtube.com/watch?v=e74VMNgARvY',\n//     title: 'Imagine Dragons - On Top of the World',\n//     hd: true,\n//     duration: 196,\n//     views: '1695902',\n//     score: -62.604333945991385 },\n//     ....\n// ]\n\n```\n\n### retrieveTrackInformations(title, artistName, exact, verbose)\nRetrieve information on the track corresponding to `title` and `artistName`. `exact` is a boolean indicating if the terms can change a little (`true` by default).\n\nReturns a **Promise** with a `trackInfos` object.\n\n\n### guessTrackFromString(query)\nTry to find a title and an artist matching the `query`. Works especially well with YouTube video names.\n\nReturns a **Promise** with an object containing:\n- `title`\n- `artistName`\n\n```js\nconst alltomp3 = require('alltomp3');\n\nconst l = (infos) =\u003e {\n  console.log(infos);\n};\n\nalltomp3.guessTrackFromString('Imagine Dragons - On Top of the World - Lyrics').then(l);\nalltomp3.guessTrackFromString('C2C - Happy Ft. D.Martin').then(l);\nalltomp3.guessTrackFromString('David Guetta - Bang My Head (Official Video) feat Sia \u0026 Fetty Wap').then(l);\nalltomp3.guessTrackFromString('David Guetta - Hey Mama (Official Video) ft Nicki Minaj, Bebe Rexha \u0026 Afrojack').then(l);\nalltomp3.guessTrackFromString('hans zimmer no time for caution').then(l);\n\n// { title: 'On Top Of The World', artistName: 'Imagine Dragons' }\n// { title: 'Happy', artistName: 'C2C' }\n// { title: 'Bang my Head (feat. Sia \u0026 Fetty Wap)', artistName: 'David Guetta' }\n// { title: 'Hey Mama', artistName: 'David Guetta' }\n// { title: 'No Time for Caution', artistName: 'Hans Zimmer' }\n```\n\n\n### findLyrics(title, artistName)\nSearch lyrics for a song.\n\nReturns a **Promise** with a `string`.\n\n```js\nconst alltomp3 = require('alltomp3');\n\nalltomp3.findLyrics('Radioactive', 'Imagine Dragons').then((lyrics) =\u003e {\n  console.log(lyrics);\n}).catch(() =\u003e {\n  console.log('No lyrics');\n});\n```\n\n\n### downloadPlaylistWithURLs(url, outputFolder, callback, maxSimultaneous)\nDownload the playlist `url` containing URLs (aka YouTube or SoundCloud playlist), convert and tag it in `outputFolder`. `maxSimultaneous` is the maximum number of parallel conversions (default to 1).\n\n#### Emit\n#### 'list': the playlist description has been received\nThis event is emitted when information about the playlist has been received, with an `array(objects)` with the following keys:\n- `url`: URL of the video/track\n- `title`: title of the video/track\n- `image`: image of the video/track\n- `progress`: object with:\n  - `download`: progression of the download\n  - `convert`: progression of the conversion\n- `infos`: `trackInfos` object\n- `file`: path to the final MP3\n\n**This array is updated as the process progress.**\n\n#### 'begin-url': a new item is processed\nThis event is emitted when a new item is now processed, with an integer `index` indicating the corresponding track.\n\n##### 'download': the download of an item is in progress\nThis event is emitted during the download, with an integer `index` indicating the corresponding track.\n\n##### 'download-end': the download end\nThis event is emitted when the download of an item end, with an integer `index` indicating the corresponding track.\n\n##### 'convert': the conversion is in progress\nThis event is emitted during the conversion, with an integer `index` indicating the corresponding track.\n\n##### 'infos': infos about the track\nThis event is emitted every time new information about a track is received, with an integer `index` indicating the corresponding track.\n\n#### 'end-url': the processing of an item is finished\nThis event is emitted when the processing of an item is finished, with an integer `index` indicating the corresponding track.\n\n##### 'end': everything is finished\nThis event is emitted at the end, when all items have been processed, with the `list` array.\n\n\n### downloadPlaylistWithTitles(url, outputFolder, callback, maxSimultaneous)\nDownload the playlist `url` containing titles (aka Deezer Playlist or Deezer Album), find best matching video on YouTube, convert and tag it in `outputFolder`. `maxSimultaneous` is the maximum number of parallel conversions (default to 1).\n\n#### Emit\n#### 'list': the playlist description has been received\nThis event is emitted when information about the playlist has been received, with an `array(objects)` with the following keys:\n- `title`: title of the track\n- `artistName`: artist of the track\n- `cover`: cover of the track\n- `progress`: object with:\n  - `download`: progression of the download\n  - `convert`: progression of the conversion\n- `infos`: `trackInfos` object\n- `file`: path to the final MP3\n\n**This array is updated as the process progress.**\n\n#### 'begin-url': a new item is processed\nThis event is emitted when a new item is now processed, with an integer `index` indicating the corresponding track.\n\n### 'search-end': the search end\nThis event is emitted when the search of YouTube videos for an item (based on the title) end, with an integer `index` indicating the corresponding track.\n\n##### 'download': the download of an item is in progress\nThis event is emitted during the download, with an integer `index` indicating the corresponding track.\n\n##### 'download-end': the download end\nThis event is emitted when the download of an item end, with an integer `index` indicating the corresponding track.\n\n##### 'convert': the conversion is in progress\nThis event is emitted during the conversion, with an integer `index` indicating the corresponding track.\n\n##### 'infos': infos about the track\nThis event is emitted every time new information about a track is received, with an integer `index` indicating the corresponding track.\n\n#### 'end-url': the processing of an item is finished\nThis event is emitted when the processing of an item is finished, with an integer `index` indicating the corresponding track.\n\n##### 'end': everything is finished\nThis event is emitted at the end, when all items have been processed, with the `list` array.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAllToMP3%2Falltomp3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAllToMP3%2Falltomp3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAllToMP3%2Falltomp3/lists"}