From b0e75f2e4476c240ce7d1929b27db7247472cb84 Mon Sep 17 00:00:00 2001 From: Luca Date: Thu, 13 Aug 2020 23:24:58 +0200 Subject: [PATCH] Storyboards: Added: Storyboards - Added the storyboards URL generation and extarction --- Debug-Log/log.json | 6 ----- Debug-Log/log.txt | 1 - src/renderer/views/Watch/Watch.js | 42 ++++++++----------------------- 3 files changed, 11 insertions(+), 38 deletions(-) delete mode 100644 Debug-Log/log.json delete mode 100644 Debug-Log/log.txt diff --git a/Debug-Log/log.json b/Debug-Log/log.json deleted file mode 100644 index a8fefca0..00000000 --- a/Debug-Log/log.json +++ /dev/null @@ -1,6 +0,0 @@ -https://i9.ytimg.com/sb/H8Gd9t7FQqI/storyboard3_L$L/$N.jpg?sqp=-oaymwGBQ7gymY2Drpcg| -80#45#158#10#10#10000#M$M#rs$AOn4CLBmFesZLLYKWd0UNT36Xx79Glm1zQ| -160#90#158#5#5#10000#M$M#rs$AOn4CLAMIjIKYqm6PxJnW7fSiydSpGJl5A' - -full: -https://i9.ytimg.com/sb/H8Gd9t7FQqI/storyboard3_L0/M$M.jpg?sqp=-oaymwGBQ7gymY2Drpcg&sigh=rs$AOn4CLBmFesZLLYKWd0UNT36Xx79Glm1zQ diff --git a/Debug-Log/log.txt b/Debug-Log/log.txt deleted file mode 100644 index 66dc9051..00000000 --- a/Debug-Log/log.txt +++ /dev/null @@ -1 +0,0 @@ -undefined \ No newline at end of file diff --git a/src/renderer/views/Watch/Watch.js b/src/renderer/views/Watch/Watch.js index ca3cab50..ee7feac8 100644 --- a/src/renderer/views/Watch/Watch.js +++ b/src/renderer/views/Watch/Watch.js @@ -294,40 +294,20 @@ export default Vue.extend({ } } - // The response provides a storyboard, however it returns a 403 error. - // Uncomment this line if that ever changes. - const TemplateUrl = result.player_response.storyboards.playerStoryboardSpecRenderer.spec - const Storyboards = TemplateUrl.split('|') - console.log('AAAAAAAAAAAAAAAAAAAAAAAAA') - const BaseUrl = new Url.URL(Storyboards.shift()) - const items = [] - FileWriter.writeFile('D:\\Workspace\\JavaScript\\FreeTube-Vue\\Debug-Log\\log.txt', BaseUrl.URLS, (err) => { - if (err) { - console.log(err) - } - }) - Storyboards.forEach((storyboard, i) => { + const templateUrl = result.player_response.storyboards.playerStoryboardSpecRenderer.spec + const storyboards = templateUrl.split('|') + const storyboardArray = [] + // Second storyboard: L1/M0 - Third storyboard: L2/M0 - Fourth: L3/M0 + + const baseUrl = storyboards.shift() + // remove the first link because it does not work + storyboards.splice(0, 1) + storyboards.forEach((storyboard, i) => { const [width, height, count, sWidth, sHeight, interval, _, sigh] = storyboard.split('#') - const BaseStoryboardUrl = new URL(BaseUrl.toString().replace('$L', i).replace('$N', 'M$M')) - BaseStoryboardUrl.searchParams.append('sigh', sigh) - items.push( - { - Url: BaseStoryboardUrl.toString(), - Width: Number(width), - Height: Number(height), - Count: Number(count), - Interval: Number(interval), - StoryboardWidth: Number(sWidth), - StoryboardHeight: Number(sHeight), - StoryboardCount: Math.ceil((Number(count) / (Number(sHeight) * Number(sWidth)))) - } - ) - console.log('URL: ', items[items.length - 1].Url) + storyboardArray.push(baseUrl.replace('$L', i + 1).replace('$N', 'M0').replace(/<\/?sub>/g, '') + '&sigh=' + sigh) }) - // this.videoStoryboardSrc = result.player_response.storyboards.playerStoryboardSpecRenderer.spec - this.videoStoryboardSrc = items[0].Url - + this.videoStoryboardSrc = storyboardArray[0] this.captionSourceList = result.player_response.captions && result.player_response.captions.playerCaptionsTracklistRenderer