mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-30 16:02:00 +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)
|
if(!result)
|
||||||
result = await this._getPlayerInfoPromise(videoId).catch(debug);
|
result = await this._getPlayerInfoPromise(videoId).catch(debug);
|
||||||
|
|
||||||
if(!result || !result.data) {
|
if(!result || !result.data) {
|
||||||
if(result && result.isAborted) {
|
if(result && result.isAborted) {
|
||||||
debug(new Error('download aborted'));
|
debug(new Error('download aborted'));
|
||||||
@@ -129,7 +128,6 @@ var YouTubeClient = GObject.registerClass({
|
|||||||
|
|
||||||
if(!result)
|
if(!result)
|
||||||
result = await this._getInfoPromise(videoId).catch(debug);
|
result = await this._getInfoPromise(videoId).catch(debug);
|
||||||
|
|
||||||
if(!result || !result.data) {
|
if(!result || !result.data) {
|
||||||
if(result && result.isAborted)
|
if(result && result.isAborted)
|
||||||
debug(new Error('download aborted'));
|
debug(new Error('download aborted'));
|
||||||
@@ -137,18 +135,13 @@ var YouTubeClient = GObject.registerClass({
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const invalidInfoMsg = (
|
if(!isFoundInTemp) {
|
||||||
!result.data.playabilityStatus
|
const [isPlayable, reason] = this._getPlayabilityStatus(result.data);
|
||||||
|| !result.data.playabilityStatus.status === 'OK'
|
|
||||||
)
|
|
||||||
? 'video is not playable'
|
|
||||||
: (!result.data.streamingData)
|
|
||||||
? 'video response data is missing streaming data'
|
|
||||||
: null;
|
|
||||||
|
|
||||||
if(invalidInfoMsg) {
|
if(!isPlayable) {
|
||||||
debug(new Error(invalidInfoMsg));
|
debug(new Error(reason));
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const info = this._getReducedInfo(result.data);
|
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)
|
_getReducedInfo(info)
|
||||||
{
|
{
|
||||||
const reduced = {
|
const reduced = {
|
||||||
|
Reference in New Issue
Block a user