mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 07:42:23 +02:00
YT: do not check playability of saved temp data
Saved video info is always playable, otherwise its not saved in first place.
This commit is contained in:
@@ -119,7 +119,6 @@ var YouTubeClient = GObject.registerClass({
|
||||
|
||||
if(!result)
|
||||
result = await this._getPlayerInfoPromise(videoId).catch(debug);
|
||||
|
||||
if(!result || !result.data) {
|
||||
if(result && result.isAborted) {
|
||||
debug(new Error('download aborted'));
|
||||
@@ -129,7 +128,6 @@ var YouTubeClient = GObject.registerClass({
|
||||
|
||||
if(!result)
|
||||
result = await this._getInfoPromise(videoId).catch(debug);
|
||||
|
||||
if(!result || !result.data) {
|
||||
if(result && result.isAborted)
|
||||
debug(new Error('download aborted'));
|
||||
@@ -137,19 +135,14 @@ var YouTubeClient = GObject.registerClass({
|
||||
break;
|
||||
}
|
||||
|
||||
const invalidInfoMsg = (
|
||||
!result.data.playabilityStatus
|
||||
|| !result.data.playabilityStatus.status === 'OK'
|
||||
)
|
||||
? 'video is not playable'
|
||||
: (!result.data.streamingData)
|
||||
? 'video response data is missing streaming data'
|
||||
: null;
|
||||
if(!isFoundInTemp) {
|
||||
const [isPlayable, reason] = this._getPlayabilityStatus(result.data);
|
||||
|
||||
if(invalidInfoMsg) {
|
||||
debug(new Error(invalidInfoMsg));
|
||||
if(!isPlayable) {
|
||||
debug(new Error(reason));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const info = this._getReducedInfo(result.data);
|
||||
|
||||
@@ -352,6 +345,20 @@ var YouTubeClient = GObject.registerClass({
|
||||
});
|
||||
}
|
||||
|
||||
_getPlayabilityStatus(info)
|
||||
{
|
||||
if(
|
||||
!info.playabilityStatus
|
||||
|| !info.playabilityStatus.status === 'OK'
|
||||
)
|
||||
return [false, 'video is not playable'];
|
||||
|
||||
if(!info.streamingData)
|
||||
return [false, 'video response data is missing streaming data'];
|
||||
|
||||
return [true, null];
|
||||
}
|
||||
|
||||
_getReducedInfo(info)
|
||||
{
|
||||
const reduced = {
|
||||
|
Reference in New Issue
Block a user