ciricc / easyvk Goto Github PK
View Code? Open in Web Editor NEWThis app helps you create an apps with vk api easy!
License: MIT License
This app helps you create an apps with vk api easy!
License: MIT License
При использовании нескольких групп, крашится из-за данной строки
groups: [
{
groupId: 1,
secret: '1',
confirmCode: '1'
},
{
groupId: 2,
secret: '2',
confirmCode: '2'
}
]
easyvk/src/utils/callbackapi.js
Line 192 in c518106
После перехода на node v16.9.1 стала вылетать ошибка:
invalid json response body at https://pu.vk.com/c520236/ss2209/upload.php?..... &api=1&wallphoto=1 reason: Unexpected token S in JSON at position 0
Реализуйте работу с клавиатурой в сообщениях пожалуйста, подглянуть можно тут https://github.com/node-vk-bot-api/node-vk-bot-api/blob/master/lib/markup.js
add res.setEncoding('utf8') to utils/staticMethods.js at call function in https.get
Everyday i get the same error:
[VK ERROR] FetchError: network timeout at: https://lp.vk.com/wh179713434...
Can you explain me, how to implement auto reconnect for bot longpoll?
Снова привет. Пытаюсь исправить пару очень важных багов, но никак не получается. Первый баг связан с капчей. Сама капча ловится, но вот captchaHandler ни в какую не хочет вызываться.
Код дефолтный из документации
const captchaHandler = ({captcha_sid, captcha_img, resolve:solve, vk}) => {
console.log(true);
}
easyvk({
username: settings.username,
password: settings.password,
captchaHandler: captchaHandler
}).then((vk) => { }).catch(console.error)
Второй баг связан с audio.get(),
аудиозаписи не получаются, если у пользователя есть хотя бы один плейлист (то есть, у владельца аккаунта всё нормально получается, даже если у него есть плейлисты. У другого пользователя треки нормально получаются, если у него нет плейлистов).
UPD: Не знаю как, но оно починилось... Но getById() по-прежнему не работает
As of Feb 11th 2020, request is fully deprecated. Consider replacing it with an alternative such as https://github.com/googleapis/teeny-request
(node:220) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'json' of undefined at self.lpConnection.fetch__default.default.catch.then (/root/node_modules/easyvk/lib/bundle.js:2304:18) at process._tickCallback (internal/process/next_tick.js:68:7) (node:220) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 8)
При попытке задать offset > 0 выдаёт ошибку UnhandledPromiseRejectionWarning
.
(node:132) UnhandledPromiseRejectionWarning: Error
at Request.request.post [as _callback] (.......\node_modules\easyvk\src\utils\AudioAPI.js:397:23)
at Request.self.callback (.......\node_modules\request\request.js:185:22)
at Request.emit (events.js:189:13)
at Request. (.......\node_modules\request\request.js:1161:10)
at Request.emit (events.js:189:13)
at IncomingMessage. (.......\node_modules\request\request.js:1083:12)
at Object.onceWrapper (events.js:277:13)
at IncomingMessage.emit (events.js:194:15)
at endReadableNT (_stream_readable.js:1103:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
(node:132) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:132) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Сам код:
vk.http.loginByForm({
cookies: __dirname + "/mycookies.json"
}).then(({client: Client}) => {
Client.audio.get({
owner_id: -45703770,
offset: 100, // Здесь
playlist_id: -1
}).then(({vkr}) => {
for(song in vkr)
songs.push(`[${song}] ${vkr[song].performer} - ${vkr[song].title}`);
}).catch(err => console.log(err));
}).catch(err => console.log(err));
easyvk 2.2.0
Если запустить пару раз скрипт, который ищет аудио и проходит до конца - приложение падает с
UnhandledPromiseRejectionWarning: Error
. При этом, исключение не ловиться через конструкцию then().catch().
(node:8420) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabli
ng certificate verification.
loop: 0
0 50
(node:8420) UnhandledPromiseRejectionWarning: Error
at Request.request.post [as _callback] (d:\dev\vk_music\node_modules\easyvk\src\utils\http.js:263:23)
at Request.self.callback (d:\dev\vk_music\node_modules\request\request.js:185:22)
at Request.emit (events.js:197:13)
at Request.<anonymous> (d:\dev\vk_music\node_modules\request\request.js:1161:10)
at Request.emit (events.js:197:13)
at IncomingMessage.<anonymous> (d:\dev\vk_music\node_modules\request\request.js:1083:12)
at Object.onceWrapper (events.js:285:13)
at IncomingMessage.emit (events.js:202:15)
at endReadableNT (_stream_readable.js:1129:12)
at processTicksAndRejections (internal/process/next_tick.js:76:17)
(node:8420) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function withou
t a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:8420) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will ter
minate the Node.js process with a non-zero exit code.
const easyvk = require('easyvk')({
username: "",
password: "",
reauth: true,
})
var vkr_output = [];
var loop = 0;
function read_audio(client, q, offset) {
client.audio.search({q:q, offset:offset}).then(({vkr}) => {
console.log('loop:', loop++)
console.log(offset, vkr.length);
if (vkr.length == 0 && offset == 0)
{
console.log("Nothing found");
return;
}
vkr_output = vkr_output.concat(vkr);
if (vkr.length < 50){
console.log(vkr_output.length, vkr_output[vkr_output.length-1])
return;
}
read_audio(client, q, offset+50);
}).catch((error) => {
console.log(error,'Promise error');
});
};
easyvk.then(vk => {
vk.http.loginByForm().then(({client}) => {
read_audio(client, 'Jesus and mary chain', 0);
}).catch((error) => {
console.log(error,'Promise error');
});
});
`npm i easyvk --save
added 50 packages, removed 2 packages, changed 2 packages, and audited 170 packages in 3s
2 packages are looking for funding
run npm fund
for details
5 vulnerabilities (3 high, 2 critical)
To address all issues (including breaking changes), run:
npm audit fix --force
Run npm audit
for details.
(base) MacBook-Pro:libs хххх$ npm fund
ххх@1.0.0
├── https://github.com/sponsors/feross
│ └── [email protected]
└── https://github.com/sponsors/epoberezkin
└── [email protected]`
Не могу разобраться. У меня есть проект, используется easyvk версия 2.5.11 . Я его обновляю до 2.6.1 и метод uploader исчезает, возвращаю 2.5.11 все работает. В документации увидел что нужно добавить utils:
async function vkAuth(username, password, sessionPath, captchaHandler) {
return await easyvk({
username: username,
password: password,
session_file: sessionPath,
captchaHandlder: captchaHandler,
utils: {
uploader: true
}
}).then(async (vk) => {
console.log(vk); // тут uploader не доступен
return vk;
});
}
Добавляю, но ничего не происходит. Что я делаю не так?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.