{"analyzedAt":"2022-07-09T12:50:36.855Z","collected":{"metadata":{"name":"horizon-youtube-mp3","scope":"unscoped","version":"1.9.2","description":"Get youtube video information and download audio in MP3 or video in MP4 format.","keywords":["youtube","mp3","converter","conversor","audio","to","download","video"],"date":"2019-07-30T02:31:43.146Z","author":{"name":"Wenderson Pires","email":"wendersonpdas@gmail.com","url":"https://www.linkedin.com/in/wenderson-pires-silva"},"publisher":{"username":"wpdas","email":"wendersonpdas@gmail.com"},"maintainers":[{"username":"wpdas","email":"wpdas@yahoo.com.br"}],"repository":{"type":"git","url":"git+https://github.com/Wpdas/horizon-youtube-mp3.git"},"links":{"npm":"https://www.npmjs.com/package/horizon-youtube-mp3","homepage":"https://github.com/Wpdas/horizon-youtube-mp3#readme","repository":"https://github.com/Wpdas/horizon-youtube-mp3","bugs":"https://github.com/Wpdas/horizon-youtube-mp3/issues"},"license":"MIT","dependencies":{"console-log-level":"^1.4.0","fluent-ffmpeg":"^2.1.2","hh-mm-ss":"^1.1.0","node-ffprobe":"^1.2.2","remove-accents":"^0.4.0","shortid":"^2.1.3","ytdl-core":"^0.20.4"},"devDependencies":{"eslint":"^4.19.1"},"releases":[{"from":"2022-06-09T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":1},{"from":"2022-04-10T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":1},{"from":"2022-01-10T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":1},{"from":"2021-07-09T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":1},{"from":"2020-07-09T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":1}],"hasTestScript":true,"readme":"# horizon-youtube-mp3\n\nGet info and download (server or local) MP3 audio from youtube videos in node.js using horizon-youtube-mp3.\n\n### Main Online App\n\nProject developed using this module:\n[YouTube Transfer App Site](http://www.youtubetransfer.com/)\n\n### Prerequisites\n\n#### ffmpeg and ffprobe\n\nfluent-ffmpeg requires ffmpeg >= 0.9 to work.  It may work with previous versions but several features won't be available (and the library is not tested with lower versions anylonger).\n\nIf the `FFMPEG_PATH` environment variable is set, fluent-ffmpeg will use it as the full path to the `ffmpeg` executable.  Otherwise, it will attempt to call `ffmpeg` directly (so it should be in your `PATH`).  You must also have ffprobe installed (it comes with ffmpeg in most distributions).  Similarly, fluent-ffmpeg will use the `FFPROBE_PATH` environment variable if it is set, otherwise it will attempt to call it in the `PATH`.\n\nMost features should work when using avconv and avprobe instead of ffmpeg and ffprobe, but they are not officially supported at the moment.\n\n**Windows users**: most probably ffmpeg and ffprobe will _not_ be in your `%PATH`, so you _must_ set `%FFMPEG_PATH` and `%FFPROBE_PATH`.\n\n**Debian/Ubuntu users**: the official repositories have the ffmpeg/ffprobe executable in the `libav-tools` package, and they are actually rebranded avconv/avprobe executables (avconv is a fork of ffmpeg).  They should be mostly compatible, but should you encounter any issue, you may want to use the real ffmpeg instead.  You can either compile it from source or find a pre-built .deb package at https://ffmpeg.org/download.html (For Ubuntu, the `ppa:jon-severinsson/ffmpeg` PPA provides recent builds).\n\n## Main features\n\n- Convert video from youtube in mp3 files (128 kBit/s) in realtime;\n- Pipe stream of converted bytes;\n- Save file in local folder (New);\n- Crop time (start and end time).\n\nWith [npm](https://www.npmjs.com/) do:\n\n```\nnpm install horizon-youtube-mp3\n```\n\n## API\n\nGet info parameters:\n```js\nhorizon.getInfo(url:String, callback:Function) => Get information from video.\n```\n\nExample:\n``` js\n// Get video information\nhorizon.getInfo(\"http://youtube.com/watch?v=NEA0BLnpOtg\", function(err, data){...});\n```\n\nDownload parameters (server):\n```js\n//Convert and send bytes to stream (download mp3 on client side)\nhorizon.download(\n  videoURL:String,\n  res:Response,\n  optionalName?:String,\n  cropParams?:Object,\n  maxTimeAllowed?:Number,\n  showSize?:Boolean,\n  callback?:Function\n  );\n```\n\nExample:\n``` js\nhorizon.download(\"http://youtube.com/watch?v=NEA0BLnpOtg\", response, null, {start:'02:15', end:'02:20'}, null, false, function(err, result){\n  //On Conversion Complete\n});\n```\n\nDownload to Local parameters (local):\n```js\n//Convert video and save the final file in local path.\nhorizon.downloadToLocal(\n  videoURL:String,\n  directory:String,\n  optionalName?:String,\n  cropParams?:Object,\n  maxTimeAllowed?:Number,\n  callback?:Function,\n  onProgress?:Function\n  );\n```\n\nParams Info:\n``` txt\nvideoURL = Url Youtube video;\nres = API Response (to server only);\ndirectory = Directory to save file (to local only);\noptionalName = A default name for the audio file;\ncropParams = Crop params;\nmaxTimeAllowed = Total time from video allowed (seconds);\nshowSize = Show size of file during download (to server only);\ncallback = Call on dowload file is complete;\nonProgress = Show progress of conversion (to local only);\n```\n\nType of errors callback:\n``` js\nlog.info(horizon.errorsType)...\nNO_DESTINATION;           => When res and directory parameters is not defined.\nLONG_VIDEO_TIME;          => Video time is longer than allowed.\nERROR_ON_GET_INFO;        => Error on get info.\nVIDEO_DOES_NOT_EXIST;     => Video does not exist.\nERROR_PROCESSING_VIDEO:   => Internal Server Error on Processing Video.\nURL_VIDEO_NOT_DEFINED;    => Url Video Not Defined.\nMISSING_CROP_PARAMS;      => Missing params on CropParams.\n```\n\nType of success callback\n``` js\nlog.info(horizon.successType)...\nCONVERSION_FILE_COMPLETE; => Conversion File Complete (and sent in response)\n```\n\n## Usage Examples\n### Get info from video.\n\n``` js\nvar horizon = require('horizon-youtube-mp3');\n\nhorizon.getInfo('http://youtube.com/watch?v=NEA0BLnpOtg', function(err, e){\n\n  console.log(e);\n\n  /**\n     * Will Return:\n     *\n     * { isValid: true,\n     *   videoName: 'OZIELZINHO - TOP GEAR 2.0',\n     *   videoThumb: 'https://i.ytimg.com/vi/NEA0BLnpOtg/hqdefault.jpg?custom=true&w=320&h=180&stc=true&jpg444=true&jpgq=90&sp=68&sigh=FoGsoudXCGPU-Fb6epRh1eIzVDs',\n     *   videoTime: '2:35',\n     *   videoTimeSec 244,\n     *   videoThumbList: {sd: 'http...', mq: 'http...', hq: 'http...', hd: 'http...'},\n     *   videoFile: 'https://....'\n     *   videoFormats: [...]}\n     */\n});\n```\n\n### Use for server-side processing and client-side downloading\n\n``` js\nvar horizon = require('horizon-youtube-mp3');\nvar http = require('http');\nvar url  = require('url') ;\nvar log = require('console-log-level')({ level: 'info' });\n\nvar server = http.createServer(function(request, response) {\n\n  var paramsUrl = url.parse(request.url, true).query;\n  log.info('URL Video: ' + paramsUrl.youtubeURL);\n\n  //var cropParams = {start:'02:15', end:'02:20'}; //Optional\n  var cropParams = null;\n\n  horizon.download(paramsUrl.youtubeURL, response, null, cropParams, null, false, function(err, e){\n\n    if(err) {\n      return log.info(err);\n    }\n\n    if(e === horizon.successType.CONVERSION_FILE_COMPLETE){\n      log.info(e);\n    }\n  });\n});\n\nserver.listen(3000);\nlog.info('Server running!');\nlog.info('Put on browser: http://localhost:3000/?youtubeURL=http://youtube.com/watch?v=NEA0BLnpOtg');\n```\n\n### Use for local processing (New)\n\n```js\nvar horizon = require('horizon-youtube-mp3');\nvar path = require('path');\n\nvar downloadPath = path.join(__dirname);\n\nhorizon.downloadToLocal(\n  'http://youtube.com/watch?v=NEA0BLnpOtg',\n  downloadPath,\n  null,\n  null,\n  null,\n  onConvertVideoComplete,\n  onConvertVideoProgress\n);\n\nfunction onConvertVideoComplete(err, result) {\n  console.log(err, result);\n  // Will return...\n  //null, conversionFileComplete\n}\n\nfunction onConvertVideoProgress(percent, timemark, targetSize) {\n  console.log('Progress:', percent, 'Timemark:', timemark, 'Target Size:', targetSize);\n  // Will return...\n  // Progress: 90.45518257038955 Timemark: 00:02:20.04 Target Size: 2189\n  // Progress: 93.73001672942894 Timemark: 00:02:25.11 Target Size: 2268\n  // Progress: 100.0083970106642 Timemark: 00:02:34.83 Target Size: 2420\n}\n```\n\n## Run examples\nGet video information:\n```\nnpm run info\n```\n\nConvert and save file to local folder:\n```\nnpm run app\n```\n\nConvert and server bytes stream to client side:\n```\nnpm run server\n```\n\n# License\nMIT"},"npm":{"downloads":[{"from":"2022-07-08T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":3},{"from":"2022-07-02T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":16},{"from":"2022-06-09T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":241},{"from":"2022-04-10T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":708},{"from":"2022-01-10T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":1080},{"from":"2021-07-09T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":2375}],"starsCount":1},"github":{"starsCount":28,"forksCount":11,"subscribersCount":5,"issues":{"count":9,"openCount":3,"distribution":{"3600":0,"10800":0,"32400":1,"97200":0,"291600":1,"874800":0,"2624400":1,"7873200":2,"23619600":1,"70858800":2,"212576400":1},"isDisabled":false},"contributors":[{"username":"Wpdas","commitsCount":1},{"username":"delmosaurio","commitsCount":1}],"commits":[{"from":"2022-07-02T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":0},{"from":"2022-06-09T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":0},{"from":"2022-04-10T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":0},{"from":"2022-01-10T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":0},{"from":"2021-07-09T00:00:00.000Z","to":"2022-07-09T00:00:00.000Z","count":0}]},"source":{"files":{"readmeSize":6708,"testsSize":0},"linters":["eslint"],"outdatedDependencies":{"node-ffprobe":{"required":"^1.2.2","stable":"3.0.0","latest":"3.0.0"},"ytdl-core":{"required":"^0.20.4","stable":"4.11.0","latest":"4.11.0"}}}},"evaluation":{"quality":{"carefulness":0.84,"tests":0,"health":0.5,"branding":0},"popularity":{"communityInterest":47,"downloadsCount":236,"downloadsAcceleration":0.2549086757990868,"dependentsCount":0},"maintenance":{"releasesFrequency":0.9,"commitsFrequency":0.9,"openIssues":0.9,"issuesDistribution":0.9}},"score":{"final":0.5165169132158258,"detail":{"quality":0.4706113509442165,"popularity":0.07250061727821978,"maintenance":0.9998808339576686}}}