-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js.old
44 lines (41 loc) · 1.08 KB
/
index.js.old
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
'use strict';
var md5pf = require('md5-part-file');
var request = require('request');
//var language = 'PL';
var np = function(file, cb) {
md5pf(file, 0, 10485760, function(err, hash){
var url = 'http://napiprojekt.pl/api/api-napiprojekt3.php';
// 'mode=1&' +
// 'client=NapiProjektPython&' +
// 'client_ver=0.1&' +
// 'downloaded_subtitles_id=' + hash + '&' +
// 'downloaded_subtitles_txt=1&' +
// 'downloaded_subtitles_lang=PL';
request({
url: url,
method: 'POST',
form: {
'mode': '32770',
'client':'pynapi',
//'client':'NapiTux',
//'client': 'NapiProjektPython',
'client_ver':'0.1',
'downloaded_subtitles_id': hash,
'downloaded_subtitles_txt':'1',
'downloaded_subtitles_lang':'PL'
}
}, function(err, resp, body){
cb(body);
});
});
};
np(
'bardzo-legalny-film-za-ktory-nie-mozna-isc-siedziec.mkv',
function(err, hash){
if (err){
console.log(err);
return;
}
console.log(hash);
}
);