youtube is being youtube. im goin to sleep

This commit is contained in:
Front 2022-03-13 20:41:03 -04:00
parent 4cb277c13a
commit 3a1973d281
5 changed files with 23 additions and 7 deletions

View File

@ -60,10 +60,10 @@ html, body {
}
p, span, div {
-webkit-user-select: none; /* Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+/Edge */
user-select: none; /* Standard */
/* -webkit-user-select: none; /* Safari */
/* -moz-user-select: none; /* Firefox */
/* -ms-user-select: none; /* IE10+/Edge */
/* user-select: none; /* Standard */
}
</style>

View File

@ -1,6 +1,6 @@
<template>
<div>
<video controls :src="vidSrc" width="100%" height="300vh" />
<video controls autoplay :src="vidSrc" width="100%" height="300vh" />
<p>[DEBUG] Streaming From: {{ vidSrc }}</p>
</div>
</template>
@ -14,7 +14,9 @@ export default {
},
mounted() {
this.$youtube.getVideo('wykQsTJElD4', (data) => {
this.vidSrc = data[data.length-1].url;
const formats = data.formats;
console.log(data)
this.vidSrc = formats[formats.length-1].url;
})
}
}

View File

@ -123,15 +123,17 @@ const module = {
Http.request({
method: 'GET',
url: 'https://youtube.com/watch',
//headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.7113.93 Safari/537.36' },
params: { q: id }
})
.then((res) => {
//--- Get HTML Only ---//
let html = res.data;
logger("getVideo-html", html);
//--- Isolate The Script Containing Video Information ---//
html = html.split("var ytInitialPlayerResponse = ")[1].split("';</script>")[0].split(";var meta = document.createElement('meta');")[0];
//--- Parse JSON ---//
const videoData = JSON.parse(html).streamingData.formats;
const videoData = JSON.parse(html).streamingData;
callback(videoData);
})

1
scripts/t.ps1 Normal file
View File

@ -0,0 +1 @@
cd .\NUXT\; npm run generate; cd ..; npx cap sync

11
temp.html Normal file

File diff suppressed because one or more lines are too long