From 461cc6569f77fd5bd6356940340fe6ced345ef4c Mon Sep 17 00:00:00 2001 From: Luca Date: Tue, 11 Aug 2020 17:28:43 +0200 Subject: [PATCH] Basic URL splitting Added: Basic URL splitting - In Watch.js (290), the extraction implementation from Omar's Invidious is implemented in JavaScript for the video storyboards --- .idea/.gitignore | 5 +++ .idea/FreeTube-Vue.iml | 12 ++++++ .idea/codeStyles/Project.xml | 40 ++++++++++++++++++++ .idea/codeStyles/codeStyleConfig.xml | 5 +++ .idea/inspectionProfiles/Project_Default.xml | 6 +++ .idea/misc.xml | 6 +++ .idea/modules.xml | 8 ++++ .idea/vcs.xml | 6 +++ Debug-Log/log.json | 6 +++ Debug-Log/log.txt | 1 + src/renderer/views/Watch/Watch.js | 32 ++++++++++++++++ 11 files changed, 127 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/FreeTube-Vue.iml create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/codeStyles/codeStyleConfig.xml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 Debug-Log/log.json create mode 100644 Debug-Log/log.txt diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..b58b603f --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/FreeTube-Vue.iml b/.idea/FreeTube-Vue.iml new file mode 100644 index 00000000..24643cc3 --- /dev/null +++ b/.idea/FreeTube-Vue.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 00000000..8ce58171 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 00000000..79ee123c --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 00000000..03d9549e --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 00000000..28a804d8 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..ecc6e5f0 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..94a25f7f --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Debug-Log/log.json b/Debug-Log/log.json new file mode 100644 index 00000000..570eede9 --- /dev/null +++ b/Debug-Log/log.json @@ -0,0 +1,6 @@ +https://i9.ytimg.com/sb/s6_azdBnAlU/storyboard3_L$L/$N.jpg?sqp=-oaymwGbA0g48quKqQOSA4gBAZUBAAAEQpgBMqABPKgBBLABELABDbABDLABELABFbABH7ABJrABLbABDrABDrABD7ABErABF7ABK7ABLLABKbABD7ABDrABELABFbABH7ABKrABMrABKbABD7ABEbABFLABGLABJrABPbABOLABLbABEbABFLABHrABKrABMbABS7ABR7ABNrABFbABHLABKbABLrABObABR7ABTbABP7ABJbABLrABN7ABPbABR7ABUrABUbABRbABM7ABQLABQrABQ7ABTLABRLABRrABQ7gBEbgBEbgBFbgBI7gBRLgBQ7gBQ7gBQ7gBEbgBE7gBFrgBL7gBQ7gBQ7gBQ7gBQ7gBFbgBFrgBKbgBQ7gBQ7gBQ7gBQ7gBQ7gBI7gBL7gBQ7gBQ7gBQ7gBQ7gBQ7gBQ7gBRLgBQ7gBQ7gBQ7gBQ7gBQ7gBQrgBQrgBQ7gBQ7gBQ7gBQ7gBQ7gBQrgBQrgBQrgBQ7gBQ7gBQ7gBQ7gBQrgBQrgBQrgBQrgBQ7gBQ7gBQ7gBQrgBQrgBQrgBQrgBQqLzl_8DBgiFlMj5BQ== +|48#27#100#10#10#0#default#rs$AOn4CLCu9a64J5sAqPWwTfONv24Uf3p_Uw +|89#45#92#10#10#10000#M$M#rs$AOn4CLBwuocwkIfcn1A5S13Aa97T7pqdGg + + +|179#90#92#5#5#10000#M$M#rs$AOn4CLD2caskvla-xuYU_wgN51Dmu3V6Ow diff --git a/Debug-Log/log.txt b/Debug-Log/log.txt new file mode 100644 index 00000000..e1769fd3 --- /dev/null +++ b/Debug-Log/log.txt @@ -0,0 +1 @@ +https://i.ytimg.com/sb/s6_azdBnAlU/storyboard3_L$L/$N.jpg?sqp=-oaymwGbA0g48quKqQOSA4gBAZUBAAAEQpgBMqABPKgBBLABELABDbABDLABELABFbABH7ABJrABLbABDrABDrABD7ABErABF7ABK7ABLLABKbABD7ABDrABELABFbABH7ABKrABMrABKbABD7ABEbABFLABGLABJrABPbABOLABLbABEbABFLABHrABKrABMbABS7ABR7ABNrABFbABHLABKbABLrABObABR7ABTbABP7ABJbABLrABN7ABPbABR7ABUrABUbABRbABM7ABQLABQrABQ7ABTLABRLABRrABQ7gBEbgBEbgBFbgBI7gBRLgBQ7gBQ7gBQ7gBEbgBE7gBFrgBL7gBQ7gBQ7gBQ7gBQ7gBFbgBFrgBKbgBQ7gBQ7gBQ7gBQ7gBQ7gBI7gBL7gBQ7gBQ7gBQ7gBQ7gBQ7gBQ7gBRLgBQ7gBQ7gBQ7gBQ7gBQ7gBQrgBQrgBQ7gBQ7gBQ7gBQ7gBQ7gBQrgBQrgBQrgBQ7gBQ7gBQ7gBQ7gBQrgBQrgBQrgBQrgBQ7gBQ7gBQ7gBQrgBQrgBQrgBQrgBQqLzl_8DBgiFlMj5BQ==|48#27#100#10#10#0#default#rs$AOn4CLDHVRzycfFSzvX-6HsZU5m70bZbTg|89#45#92#10#10#10000#M$M#rs$AOn4CLDxmuxU7t8lN2-aRglo_B0bb0sbxg|179#90#92#5#5#10000#M$M#rs$AOn4CLCOmNcCRoAr84FxqBNzUt1e47eKhg \ No newline at end of file diff --git a/src/renderer/views/Watch/Watch.js b/src/renderer/views/Watch/Watch.js index c681f99d..03b97f7a 100644 --- a/src/renderer/views/Watch/Watch.js +++ b/src/renderer/views/Watch/Watch.js @@ -12,6 +12,9 @@ import WatchVideoComments from '../../components/watch-video-comments/watch-vide import WatchVideoLiveChat from '../../components/watch-video-live-chat/watch-video-live-chat.vue' import WatchVideoPlaylist from '../../components/watch-video-playlist/watch-video-playlist.vue' import WatchVideoRecommendations from '../../components/watch-video-recommendations/watch-video-recommendations.vue' +import FileWriter from 'fs' +import Url from 'url' +import Utils from 'util' export default Vue.extend({ name: 'Watch', @@ -293,6 +296,35 @@ 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('|') + + const BaseUrl = Url.url.parse(Storyboards.shift(), true) + const BaseUrlParams = BaseUrl.query + const items = [] + Storyboards.forEach((storyboard, i) => { + const [width, height, count, sWidth, sHeight, interval, _, sigh] = storyboard.split('#') + const BaseStoryboardUrl = BaseUrl.sub('$L', i).sub('$N', 'M$M') + BaseUrlParams.sigh = sigh + BaseUrl.query = BaseUrlParams + items.push( + { + Url: BaseStoryboardUrl, + 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)))) + } + ) + }) + FileWriter.writeFile('D:\\Workspace\\JavaScript\\FreeTube-Vue\\Debug-Log\\log.txt', TemplateUrl, (err) => { + if (err) { + console.log(err) + } + }) // this.videoStoryboardSrc = result.player_response.storyboards.playerStoryboardSpecRenderer.spec this.captionSourceList =