<commit_before>#!/usr/bin/env node
'use strict';require('babel-polyfill');var _commander=require('commander');var _commander2=_interopRequireDefault(_commander);var _coPrompt=require('co-prompt');var _coPrompt2=_interopRequireDefault(_coPrompt);var _ora=require('ora');var _ora2=_interopRequireDefault(_ora);var _co=require('co');var _co2=_interopRequireDefault(_co);var _chalk=require('chalk');var _chalk2=_interopRequireDefault(_chalk);var _fs=require('fs');var _fs2=_interopRequireDefault(_fs);var _download=require('./download');var _torrent=require('./torrent');var _unrestrict=require('./unrestrict');var _unrestrict2=_interopRequireDefault(_unrestrict);var _connect=require('./connect');var _connect2=_interopRequireDefault(_connect);var _package=require('../package.json');var _package2=_interopRequireDefault(_package);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}_commander2.default.version(_package2.default.version).description('Download links, magnets and torrent files.').usage('<url|magnet|torrent>').action(function(arg){return(0,_co2.default)(regeneratorRuntime.mark(function action(){var username,password,token,link,unrestrictLink,spinner;return regeneratorRuntime.wrap(function action$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.prev=0;_context.next=3;return(0,_coPrompt2.default)('Username: ');case 3:username=_context.sent;_context.next=6;return _coPrompt2.default.password('Password: ');case 6:password=_context.sent;_context.next=9;return(0,_connect2.default)(username,password);case 9:token=_context.sent;link=void 0;if(!arg.match(/^(https?:\/\/)([\da-z.-]+).([a-z.]{2,6})([/\w? .-]*)*\/?$/)){_context.next=15;break;}link=arg;_context.next=23;break;case 15:if(!(arg.match(/^magnet:\?xt=urn:[a-z0-9]+:[a-z0-9]{20,50}/i)||_fs2.default.existsSync(arg))){_context.next=21;break;}_context.next=18;return(0,_torrent.convertTorrent)(arg,token);case 18:link=_context.sent;_context.next=23;break;case 21:console.log('Usage: rdcli <url|magnet|torrent>');process.exit();case 23:_context.next=25;return(0,_unrestrict2.default)(link,token);case 25:unrestrictLink=_context.sent;console.log('Start download : '+unrestrictLink);_context.next=29;return(0,_download.waitDuringScan)(link);case 29:spinner=(0,_ora2.default)('Download: 0.0% Speed: 0Mbps').start();(0,_download.download)(unrestrictLink,function(res){if(res.percent){spinner.text='Download: '+res.percent+'% Speed: '+res.mbps+' '+res.bytesWriting+'/'+res.totalSize+' Remaining: '+res.remaining+'sec';// eslint-disable-line max-len
}else if(res==='end'){spinner.stop();console.log('File downloaded.');}else{spinner.stop();console.log('Error: '+res);}});_context.next=37;break;case 33:_context.prev=33;_context.t0=_context['catch'](0);console.error('\n'+_chalk2.default.red(_context.t0));process.exit();case 37:case'end':return _context.stop();}}},action,this,[[0,33]]);}));}).parse(process.argv);if(!process.argv.slice(2).length){_commander2.default.outputHelp();}<commit_msg>Build<commit_after>#!/usr/bin/env node
'use strict';require('babel-polyfill');var _commander=require('commander');var _commander2=_interopRequireDefault(_commander);var _coPrompt=require('co-prompt');var _coPrompt2=_interopRequireDefault(_coPrompt);var _ora=require('ora');var _ora2=_interopRequireDefault(_ora);var _co=require('co');var _co2=_interopRequireDefault(_co);var _chalk=require('chalk');var _chalk2=_interopRequireDefault(_chalk);var _fs=require('fs');var _fs2=_interopRequireDefault(_fs);var _download=require('./download');var _torrent=require('./torrent');var _unrestrict=require('./unrestrict');var _unrestrict2=_interopRequireDefault(_unrestrict);var _connect=require('./connect');var _connect2=_interopRequireDefault(_connect);var _package=require('../package.json');var _package2=_interopRequireDefault(_package);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}_commander2.default.version(_package2.default.version).description('Download links, magnets and torrent files.').usage('<url|magnet|torrent>').action(function(arg){return(0,_co2.default)(regeneratorRuntime.mark(function action(){var username,password,token,link,unrestrictLink,spinner;return regeneratorRuntime.wrap(function action$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.prev=0;_context.t0=process.env.REALDEBRID_USERNAME;if(_context.t0){_context.next=6;break;}_context.next=5;return(0,_coPrompt2.default)('Username: ');case 5:_context.t0=_context.sent;case 6:username=_context.t0;_context.t1=process.env.REALDEBRID_PASSWORD;if(_context.t1){_context.next=12;break;}_context.next=11;return _coPrompt2.default.password('Password: ');case 11:_context.t1=_context.sent;case 12:password=_context.t1;_context.next=15;return(0,_connect2.default)(username,password);case 15:token=_context.sent;link=void 0;if(!arg.match(/^(https?:\/\/)([\da-z.-]+).([a-z.]{2,6})([/\w? .-]*)*\/?$/)){_context.next=21;break;}link=arg;_context.next=29;break;case 21:if(!(arg.match(/^magnet:\?xt=urn:[a-z0-9]+:[a-z0-9]{20,50}/i)||_fs2.default.existsSync(arg))){_context.next=27;break;}_context.next=24;return(0,_torrent.convertTorrent)(arg,token);case 24:link=_context.sent;_context.next=29;break;case 27:console.log('Usage: rdcli <url|magnet|torrent>');process.exit();case 29:_context.next=31;return(0,_unrestrict2.default)(link,token);case 31:unrestrictLink=_context.sent;console.log('Start download : '+unrestrictLink);_context.next=35;return(0,_download.waitDuringScan)(link);case 35:spinner=(0,_ora2.default)('Download: 0.0% Speed: 0Mbps').start();(0,_download.download)(unrestrictLink,function(res){if(res.percent){spinner.text='Download: '+res.percent+'% Speed: '+res.mbps+' '+res.bytesWriting+'/'+res.totalSize+' Remaining: '+res.remaining+'sec';// eslint-disable-line max-len
}else if(res==='end'){spinner.stop();console.log('File downloaded.');}else{spinner.stop();console.log('Error: '+res);}});_context.next=43;break;case 39:_context.prev=39;_context.t2=_context['catch'](0);console.error('\n'+_chalk2.default.red(_context.t2));process.exit();case 43:case'end':return _context.stop();}}},action,this,[[0,39]]);}));}).parse(process.argv);if(!process.argv.slice(2).length){_commander2.default.outputHelp();}
{'fraction_non_alphanumeric': 0.20461095100864554, 'fraction_numerical': 0.03234069804674992, 'mean_word_length': 14.12590799031477, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5235975', 'n_tokens_mistral': 2231, 'n_tokens_neox': 2139, 'n_words': 145}