Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module.exports = {
- keywords: ['soundcloud','scmp3'],
- name: 'soundcloud',
- description: 'Plugin tải nhạc từ Soundcloud từ url',
- guide: '<url>',
- childs: [],
- permission: {
- '*': '*'
- },
- datastoreDesign: {
- account: {
- global: {},
- local: {}
- },
- thread: {
- global: {},
- local: {}
- }
- },
- async onLoad() {},
- hookType: 'none',
- async onMessage(message, reply) {},
- async onCall(message, reply) {
- const url = kb2abot.helpers.getParam(message.body);
- if (url){
- const song = url.split('soundcloud.com/')[1].split('?')[0];
- const url_crawl = `https://scr.flawcra.cc/${encodeURIComponent(song)}.mp3`;
- let r = await fetch(url_crawl, {
- headers:{
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063"
- }});
- if (r.status == 200){
- let buf = await r.buffer();
- let file = new streamBuffers.ReadableStreamBuffer({frequency: 10, chunkSize: 2048});
- file.path = "scdl.mp3", file.put(buf), file.stop();
- reply({attachment: file}, message.threadID, message.messageID)
- } else {
- reply("err", message.threadID, message.messageID);
- }
- }
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement