mirror of
https://github.com/VueTubeApp/VueTube
synced 2025-01-05 07:01:14 +00:00
possibly make ytdl work?
This commit is contained in:
parent
28aeba16f6
commit
748ae00651
2 changed files with 8 additions and 17 deletions
|
@ -1,5 +1,6 @@
|
|||
//--- Modules/Imports ---//
|
||||
import { Http } from '@capacitor-community/http';
|
||||
const ytdl = require('ytdl-core');
|
||||
|
||||
//--- Logger Function ---//
|
||||
function logger(func, data, isError=false) {
|
||||
|
@ -55,7 +56,7 @@ function youtubeSearch(text, callback) {
|
|||
let html = res.data;
|
||||
//--- Isolate The Script Containing Video Information ---//
|
||||
html = html.split("var ytInitialData = '")[1].split("';</script>")[0];
|
||||
|
||||
|
||||
youtubeParse(html, (data) => {
|
||||
callback(data);
|
||||
})
|
||||
|
@ -118,22 +119,11 @@ const module = {
|
|||
|
||||
},
|
||||
|
||||
getVideo(id, callback) {
|
||||
async getVideo(id, callback) {
|
||||
|
||||
Http.request({
|
||||
method: 'GET',
|
||||
url: 'https://vuetube-core.sushipython.repl.co/id/'+id
|
||||
})
|
||||
.then((res) => {
|
||||
const videoData = res.data;
|
||||
logger("videoData", videoData)
|
||||
callback(videoData);
|
||||
|
||||
})
|
||||
.catch((err) => {
|
||||
logger("getVideo", err, true);
|
||||
callback(err);
|
||||
});
|
||||
const vidInfo = await ytdl.getInfo(id);
|
||||
logger("getVideo", vidInfo)
|
||||
callback(vidInfo);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"@capacitor/browser": "^1.0.7",
|
||||
"@capacitor/cli": "^3.4.0",
|
||||
"@capacitor/core": "^3.4.0",
|
||||
"@capacitor/device": "^1.1.2"
|
||||
"@capacitor/device": "^1.1.2",
|
||||
"ytdl-core": "^4.11.0"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue