{"analyzedAt":"2022-06-27T18:52:20.737Z","collected":{"metadata":{"name":"torrents-search","scope":"unscoped","version":"2.0.6","description":"Search torrents on private and public trackers websites","keywords":["torrents","1337x","torrent9","private tracker","tracker"],"date":"2017-07-26T12:36:15.876Z","author":{"name":"Leeroy Brun","email":"leeroy.brun@gmail.com","username":"leeroy"},"publisher":{"username":"leeroy","email":"leeroy.brun@gmail.com"},"maintainers":[{"username":"leeroy","email":"leeroy.brun@gmail.com"}],"repository":{"type":"git","url":"git+https://github.com/leeroybrun/node-torrents-search.git"},"links":{"npm":"https://www.npmjs.com/package/torrents-search","homepage":"https://github.com/leeroybrun/node-torrents-search#readme","repository":"https://github.com/leeroybrun/node-torrents-search","bugs":"https://github.com/leeroybrun/node-torrents-search/issues"},"license":"MIT","dependencies":{"debug":"^2.6.6","extend":"^3.0.1","request":"^2.81.0","request-x-ray":"^0.1.4","string-format":"^0.5.0","torrent-name-parse":"~1.1.0","urlify":"^0.3.6","x-ray":"^2.3.2","xregexp":"^3.2.0"},"devDependencies":{"chai":"^3.5.0","jshint":"^2.9.4","mocha":"^3.4.1"},"releases":[{"from":"2022-05-28T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":0},{"from":"2022-03-29T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":0},{"from":"2021-12-29T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":0},{"from":"2021-06-27T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":0},{"from":"2020-06-27T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":0}],"hasTestScript":true,"readme":"# node-torrents-search\r\n\r\n[![NPM](https://nodei.co/npm/torrents-search.png)](https://nodei.co/npm/torrents-search/) [![David DM](https://david-dm.org/leeroybrun/node-torrents-search.png)](https://david-dm.org/leeroybrun/node-torrents-search \"David DM\")\r\n\r\nNode module used to search torrents on private trackers websites.\r\n\r\n## Currently supported trackers\r\n\r\n- 1337x\r\n- Torrent9\r\n- TorrentLeech\r\n- ~~Cpasbien~~\r\n- ~~t411~~\r\n- ~~FrenchTorrentDB~~\r\n\r\nYou can easily add new trackers by creating a file in `lib/trackers`.\r\n\r\n## Install\r\n\r\n```shell\r\nnpm install torrents-search\r\n```\r\n\r\n## Usage\r\n\r\n```javascript\r\nconst TorrentsSearch = require('..');\r\nconst extend = require('extend');\r\n\r\n// Custom logger\r\nconst myLogger = {\r\n  info: function(msg) {\r\n    console.log(msg);\r\n  },\r\n\r\n  error: function(msg) {\r\n    console.error(msg);\r\n  }\r\n};\r\n\r\nconst search = new TorrentsSearch({\r\n  logger: myLogger, // Optional\r\n  timeout: 100000 // Optional\r\n});\r\n\r\nsearch.loadTrackers()\r\n  .then(() => {\r\n    // Display all loaded trackers\r\n    console.log('Loaded trackers :', search.getTrackers());\r\n\r\n    // Enable trackers\r\n    search.enableTracker('Torrent9');\r\n    search.enableTracker('1337x');\r\n\r\n    search.enableTracker('TorrentLeech');\r\n    search.setCredentials('TorrentLeech', 'USERNAME', 'PASSWORD');\r\n  })\r\n  .then(() => {\r\n    // Search torrents on all enabled trackers\r\n    return search.search('SEARCH_QUERY', {type: 'movies'});\r\n  })\r\n  .then((torrents) => {\r\n    console.log(torrents.length +' torrent(s) found.');\r\n\r\n    if(torrents.length === 0) {\r\n      return null;\r\n    }\r\n\r\n    torrents.forEach((torrent) => {\r\n      const t = extend(true, {}, torrent);\r\n      delete t._tracker;\r\n\r\n      console.log(t);\r\n    });\r\n\r\n    console.log('Downloading first torrent ('+ torrents[0].name +' from '+ torrents[0].tracker +') :');\r\n    return search.download(torrents[0]);\r\n  })\r\n  .then((torrentFileBuffer) => {\r\n    if(torrentFileBuffer) {\r\n      console.log(torrentFileBuffer);\r\n    }\r\n  }).catch((reason) => {\r\n    console.error('An error occured:');\r\n    console.error(reason);\r\n  });\r\n```\r\n\r\n## Options\r\n\r\n* `logger` This let you define a custom logger. It should have two methods : `info` and `error`. If you just want to log errors, just create an empty `info` method. Default is an empty logger that will do nothing.\r\n* `timeout` Define the desired timeout (milliseconds) for requests sent to trackers. Default is 10000 (10s). This is a way to protect us from slow trackers who can block others.\r\n\r\n## Events\r\n\r\n* `on('trackers:loaded', function(trackers) {})`\r\n\r\n\tWhen trackers are loaded.\r\n\r\n* `on('tracker:enabled', function(tracker) {})`\r\n\r\n\tWhen a tracker is enabled.\r\n\r\n* `on('tracker:disabled', function(tracker) {})`\r\n\r\n\tWhen a tracker is disabled.\r\n\r\n* `on('tracker:loginSuccess', function(tracker) {})`\r\n\r\n\tWhen a login is successfull on a tracker.\r\n\r\n* `on('tracker:torrentsFound', function(torrents, tracker) {})`\r\n\r\n\tWhen torrents are found on a tracker.\r\n\r\n* `on('tracker:torrentsSearchError', function(error, tracker) {})`\r\n\r\n\tWhen an error occurs during torrents search on a tracker.\r\n\r\n* `on('tracker:torrentsSearchError', function(error, tracker) {})`\r\n\r\n\tWhen an error occurs during torrents search on a tracker.\r\n\r\n\r\n## API\r\n\r\nHere is the list of all available methods of the module.\r\n\r\n* `loadTrackers()`\r\n\r\n    Load all the trackers in the `lib/trackers` folder.\r\n    You need to call this before calling any other method.\r\n    All trackers loaded are disabled by default if they need authentification, or enabled if not.\r\n    \r\n    It returns a promise.\r\n\r\n* `getTrackers()`\r\n\r\n    Return an object `{ enabled: [], disabled: [] }` with the names of the loaded trackers.\r\n\r\n* `enableTracker(trackerName)`\r\n\r\n    Enable the specified tracker.\r\n    \r\n    Returns a boolean indicating if the operation succeeded or not.\r\n\r\n* `disableTracker(trackerName)`\r\n\r\n    Disable the specified tracker.\r\n    \r\n    Returns a boolean indicating if the operation succeeded or not.\r\n\r\n* `setCredentials(trackerName, username, password)`\r\n\r\n    Set the username/password used for the tracker.\r\n\r\n* `login()`\r\n\r\n    Login on all enabled trackers.\r\n    This is automatically done when using a method requiring login (search, download).\r\n    \r\n    It returns a promise.\r\n\r\n* `search(query, options, callback)`\r\n\r\n    Search the specified `query` on all enabled trackers.\r\n    \r\n    Options is an object with the following properties :\r\n    \r\n    * `type` : `movie` or `tvshow`\r\n    \r\n    It returns a promise with an array of Torrent objects if resolved.\r\n\r\n* `download(torrent, callback)`\r\n\r\n    Download the specified `.torrent`.\r\n    \r\n    It returns a promise with an the file buffer of the `.torrent` if resolved.\r\n\r\n## TODO\r\n\r\n- [ ] Add tests\r\n- [ ] Use [x-rax](https://www.npmjs.com/package/x-ray)\r\n- [ ] Use [string-format](https://www.npmjs.com/package/string-format)\r\n- Add more trackers\r\n  - [x] Torrent9\r\n  - [x] 1337x\r\n  - [x] torrentleech\r\n  - [ ] katcr.co/new\r\n  - [ ] torrentproject\r\n  - [ ] iptorrents\r\n\r\n\r\n## Changelog\r\n\r\n### v2.0.5\r\n\r\n- [x] Fix \"regex\" x-ray filter to get IDs of Torrent9 & 1337x torrents\r\n\r\n### v2.0.3\r\n\r\n- [x] Fix typo\r\n\r\n### v2.0.2\r\n\r\n- [x] Bugfixes\r\n\r\n### v2.0.1\r\n\r\n- [x] Add TorrentLeech tracker\r\n\r\n### v2.0.0\r\n\r\n- [x] Refactor Tracker class to use [x-rax](https://www.npmjs.com/package/x-ray)\r\n- [x] Remove Babel\r\n- [x] Switch to yarn\r\n- [x] Cleanup\r\n- [x] Remove t411 tracker\r\n- [x] Remove Cpasbien tracker\r\n- [x] Add 1337x tracker\r\n- [x] Add Torrent9 tracker\r\n\r\n### v1.1.0\r\n\r\n- [x] Size of torrents in bytes\r\n\r\n### v1.0.4\r\n\r\n- [x] Update depencencies\r\n- [x] Remove FrenchTorrentDB (dead)\r\n- [x] Update Cpasbien domain\r\n\r\n\r\nLicence\r\n======================\r\n(The MIT License)\r\n\r\nCopyright (C) 2013 Leeroy Brun, www.leeroy.me\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\r\n\r\nTHE 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."},"npm":{"downloads":[{"from":"2022-06-26T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":0},{"from":"2022-06-20T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":36},{"from":"2022-05-28T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":56},{"from":"2022-03-29T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":371},{"from":"2021-12-29T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":709},{"from":"2021-06-27T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":1362}],"starsCount":2},"github":{"starsCount":15,"forksCount":10,"subscribersCount":2,"issues":{"count":5,"openCount":1,"distribution":{"3600":0,"10800":0,"32400":0,"97200":1,"291600":0,"874800":1,"2624400":0,"7873200":1,"23619600":1,"70858800":0,"212576400":1},"isDisabled":false},"contributors":[{"username":"leeroybrun","commitsCount":92}],"commits":[{"from":"2022-06-20T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":0},{"from":"2022-05-28T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":0},{"from":"2022-03-29T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":0},{"from":"2021-12-29T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":0},{"from":"2021-06-27T00:00:00.000Z","to":"2022-06-27T00:00:00.000Z","count":0}]},"source":{"files":{"readmeSize":6567,"testsSize":1014,"hasNpmIgnore":true,"hasChangelog":true},"badges":[{"urls":{"original":"https://nodei.co/npm/torrents-search.png","shields":"https://img.shields.io/npm/v/torrents-search.svg","content":"https://img.shields.io/npm/v/torrents-search.json"},"info":{"service":"npm","type":"version"}},{"urls":{"original":"https://david-dm.org/leeroybrun/node-torrents-search.png","service":"https://david-dm.org/leeroybrun/node-torrents-search.svg","shields":"https://img.shields.io/david/leeroybrun/node-torrents-search.svg","content":"https://img.shields.io/david/leeroybrun/node-torrents-search.json"},"info":{"service":"david","type":"dependencies","modifiers":{"statusType":"normal"}}}],"linters":["jshint"],"outdatedDependencies":{"string-format":{"required":"^0.5.0","stable":"2.0.0","latest":"2.0.0"},"xregexp":{"required":"^3.2.0","stable":"5.1.1","latest":"5.1.1"},"debug":{"required":"^2.6.6","stable":"4.3.4","latest":"4.3.4"}}}},"evaluation":{"quality":{"carefulness":0.9999999999999999,"tests":0.6,"health":0.5,"branding":0.3},"popularity":{"communityInterest":30,"downloadsCount":123.66666666666667,"downloadsAcceleration":-0.4143645357686453,"dependentsCount":0},"maintenance":{"releasesFrequency":0.9,"commitsFrequency":0.9,"openIssues":1,"issuesDistribution":0.9}},"score":{"final":0.6366693302491563,"detail":{"quality":0.8825240166869178,"popularity":0.06269968881557324,"maintenance":0.9999063833075152}}}