mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-29 23:32:04 +02:00
YT: reduce amount of temp data stored per video
This commit is contained in:
@@ -136,30 +136,22 @@ var YouTubeClient = GObject.registerClass({
|
||||
|
||||
break;
|
||||
}
|
||||
const info = result.data;
|
||||
|
||||
const invalidInfoMsg = (
|
||||
!info.playabilityStatus
|
||||
|| !info.playabilityStatus.status === 'OK'
|
||||
!result.data.playabilityStatus
|
||||
|| !result.data.playabilityStatus.status === 'OK'
|
||||
)
|
||||
? 'video is not playable'
|
||||
: (!info.streamingData)
|
||||
: (!result.data.streamingData)
|
||||
? 'video response data is missing streaming data'
|
||||
: null;
|
||||
|
||||
if(invalidInfoMsg) {
|
||||
this.lastInfo = null;
|
||||
|
||||
debug(new Error(invalidInfoMsg));
|
||||
break;
|
||||
}
|
||||
|
||||
/* Make sure we have all formats arrays,
|
||||
* so we will not have to keep checking */
|
||||
if(!info.streamingData.formats)
|
||||
info.streamingData.formats = [];
|
||||
if(!info.streamingData.adaptiveFormats)
|
||||
info.streamingData.adaptiveFormats = [];
|
||||
const info = this._getReducedInfo(result.data);
|
||||
|
||||
if(this._getIsCipher(info.streamingData)) {
|
||||
debug('video requires deciphering');
|
||||
@@ -360,6 +352,28 @@ var YouTubeClient = GObject.registerClass({
|
||||
});
|
||||
}
|
||||
|
||||
_getReducedInfo(info)
|
||||
{
|
||||
const reduced = {
|
||||
videoDetails: {
|
||||
videoId: info.videoDetails.videoId,
|
||||
title: info.videoDetails.title,
|
||||
lengthSeconds: info.videoDetails.lengthSeconds,
|
||||
isLiveContent: info.videoDetails.isLiveContent
|
||||
},
|
||||
streamingData: info.streamingData
|
||||
};
|
||||
|
||||
/* Make sure we have all formats arrays,
|
||||
* so we will not have to keep checking */
|
||||
if(!reduced.streamingData.formats)
|
||||
reduced.streamingData.formats = [];
|
||||
if(!reduced.streamingData.adaptiveFormats)
|
||||
reduced.streamingData.adaptiveFormats = [];
|
||||
|
||||
return reduced;
|
||||
}
|
||||
|
||||
_getPlayerInfoPromise(videoId)
|
||||
{
|
||||
const data = this._getPlayerPostData(videoId);
|
||||
|
Reference in New Issue
Block a user