Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getFileWithId(userId, docId, func){
- fetch('https://vk.com/doc' + userId + '_' + docId).then(page => {
- page.arrayBuffer().then(arr => {
- var str = new TextDecoder('windows-1251').decode(arr);
- func(isDocValid(str), docId);
- });
- });
- }
- function isDocValid(text){
- return text.indexOf('Файл был удалён') === -1 && text.indexOf('Этот документ был удалён из общего доступа.') === -1;
- }
- function testUser(user, start, count){
- var results = 0;
- for(var i = start; i <= start + count; i++){
- getFileWithId(user, i, function(result, docId){
- if(result){
- console.log(docId + ' положительный!');
- }
- results++;
- if(results > count){
- console.log('Тест завершён.');
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment