mirror of https://github.com/VueTubeApp/VueTube
feat: recommendation based on watch history
This commit is contained in:
parent
9d83a56aeb
commit
6d9df0dfbf
|
@ -198,6 +198,7 @@ export default {
|
||||||
|
|
||||||
//--- API WatchTime call ---//
|
//--- API WatchTime call ---//
|
||||||
this.playbackTracking = result.playbackTracking;
|
this.playbackTracking = result.playbackTracking;
|
||||||
|
this.st = 0;
|
||||||
this.cpn = getCpn();
|
this.cpn = getCpn();
|
||||||
this.initWatchTime().then(() => {
|
this.initWatchTime().then(() => {
|
||||||
this.sendWatchTime();
|
this.sendWatchTime();
|
||||||
|
@ -227,14 +228,23 @@ export default {
|
||||||
},
|
},
|
||||||
sendWatchTime() {
|
sendWatchTime() {
|
||||||
const player = this.$refs.player.getPlayer();
|
const player = this.$refs.player.getPlayer();
|
||||||
|
const rt = Math.floor(Date.now() / 1000) - this.startTime;
|
||||||
|
const params = {
|
||||||
|
cpn: this.cpn,
|
||||||
|
rt: rt,
|
||||||
|
rti: rt,
|
||||||
|
rtn: rt,
|
||||||
|
cmt: player.currentTime,
|
||||||
|
et: player.currentTime,
|
||||||
|
st: this.st,
|
||||||
|
state: player.paused ? "paused" : "playing",
|
||||||
|
volume: 100,
|
||||||
|
muted: 0,
|
||||||
|
fmt: 396,
|
||||||
|
};
|
||||||
|
this.st = player.currentTime;
|
||||||
this.$youtube.saveApiStats(
|
this.$youtube.saveApiStats(
|
||||||
{
|
params,
|
||||||
cpn: this.cpn,
|
|
||||||
rt: Math.floor(Date.now() / 1000) - this.startTime,
|
|
||||||
et: player.currentTime,
|
|
||||||
state: player.paused ? "paused" : "playing",
|
|
||||||
volume: 100,
|
|
||||||
},
|
|
||||||
this.playbackTracking.videostatsWatchtimeUrl.baseUrl
|
this.playbackTracking.videostatsWatchtimeUrl.baseUrl
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -243,7 +253,11 @@ export default {
|
||||||
await this.$youtube.saveApiStats(
|
await this.$youtube.saveApiStats(
|
||||||
{
|
{
|
||||||
cpn: this.cpn,
|
cpn: this.cpn,
|
||||||
|
fmt: 243,
|
||||||
|
rtn: Math.floor(Date.now() / 1000) - this.startTime,
|
||||||
rt: Math.floor(Date.now() / 1000) - this.startTime,
|
rt: Math.floor(Date.now() / 1000) - this.startTime,
|
||||||
|
fmt: 243,
|
||||||
|
muted: 0,
|
||||||
},
|
},
|
||||||
this.playbackTracking.videostatsPlaybackUrl.baseUrl
|
this.playbackTracking.videostatsPlaybackUrl.baseUrl
|
||||||
);
|
);
|
||||||
|
|
|
@ -193,7 +193,15 @@ class Innertube {
|
||||||
console.log(params);
|
console.log(params);
|
||||||
await Http.get({
|
await Http.get({
|
||||||
url: url,
|
url: url,
|
||||||
params: params,
|
params: {
|
||||||
|
...params,
|
||||||
|
...{
|
||||||
|
ver: 2,
|
||||||
|
c: constants.YT_API_VALUES.CLIENTNAME.toLowerCase(),
|
||||||
|
cbrver: constants.YT_API_VALUES.VERSION,
|
||||||
|
cver: constants.YT_API_VALUES.VERSION,
|
||||||
|
},
|
||||||
|
},
|
||||||
headers: this.header,
|
headers: this.header,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue