FreeTubeApp / yt-dash-manifest-generator

GNU General Public License v3.0
10 stars 5 forks source link

v1.1.0 @freetube/yt-dash-manifest-generator npm package is broken and differs from yt-dash-manifest-generator #2

Closed absidue closed 2 years ago

absidue commented 2 years ago

While messing around with the FreeTube dependencies I discovered that the 1.1.0 version of yt-dash-manifest-generator works however the 1.1.0 version of @freetube/yt-dash-manifest-generator doesn't. It produces the following error in FreeTube:

broken

After investigating I noticed that the @freetube/yt-dash-manifest-generator package on npm contains four extra lines, which when removed in the file in the node_modules directory fix the error:

diff --git a/gm-DashGenerator.js b/ft-DashGenerator.js
index d3a687e..c405230 100644
--- a/gm-DashGenerator.js
+++ b/ft-DashGenerator.js
@@ -136,6 +136,10 @@ class DashGenerator {
                 return
             }
             const mimeType = videoFormat.mimeType.split(';')[0]
+            if (mimeType === 'video/mp4' ||mimeType === 'audio/mp4' || mimeType === 'audio/webm') {
+                return
+            }
+            console.log("FORMAT", videoFormat)
             const mimeTypeIndex = mimeTypes.indexOf(mimeType)
             if (mimeTypeIndex > -1) {
                 mimeObjects[mimeTypeIndex].push(videoFormat)

As those lines don't exist on the development branch of this repository I would recommend releasing a new version with the fix, this allows the FreeTube dependency to be updated to point to this repository instead of the old repository.

The testing in FreeTube was done on the lastest commit, at the time of writing, https://github.com/FreeTubeApp/FreeTube/commit/53ed89c6a37ac786bb93e1d5c89d2b7e3b2ac5ad with these changes:

diff --git a/package.json b/package.json
index cadb3823..d4019fca 100644
--- a/package.json
+++ b/package.json
@@ -56,6 +56,7 @@
     "@fortawesome/vue-fontawesome": "^2.0.2",
     "@freetube/youtube-chat": "^1.1.2",
     "@freetube/yt-comment-scraper": "^6.0.0",
+    "@freetube/yt-dash-manifest-generator": "1.1.0",
     "@silvermine/videojs-quality-selector": "^1.2.5",
     "autolinker": "^3.14.3",
     "bulma-pro": "^0.2.0",
@@ -90,7 +91,6 @@
     "vuex": "^3.6.2",
     "youtube-suggest": "^1.1.2",
     "yt-channel-info": "^3.0.3",
-    "yt-dash-manifest-generator": "1.1.0",
     "yt-trending-scraper": "^2.0.1",
     "ytdl-core": "^4.11.0",
     "ytpl": "^2.3.0",
diff --git a/src/renderer/views/Watch/Watch.js b/src/renderer/views/Watch/Watch.js
index b1b3e887..00d5a9e5 100644
--- a/src/renderer/views/Watch/Watch.js
+++ b/src/renderer/views/Watch/Watch.js
@@ -2,7 +2,7 @@ import Vue from 'vue'
 import { mapActions } from 'vuex'
 import $ from 'jquery'
 import fs from 'fs'
-import ytDashGen from 'yt-dash-manifest-generator'
+import ytDashGen from '@freetube/yt-dash-manifest-generator'
 import FtLoader from '../../components/ft-loader/ft-loader.vue'
 import FtCard from '../../components/ft-card/ft-card.vue'
 import FtElementList from '../../components/ft-element-list/ft-element-list.vue'
diff --git a/yarn.lock b/yarn.lock
index a438de97..ea947086 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1025,6 +1025,14 @@
   dependencies:
     axios "^0.21.1"

+"@freetube/yt-dash-manifest-generator@1.1.0":
+  version "1.1.0"
+  resolved "https://registry.yarnpkg.com/@freetube/yt-dash-manifest-generator/-/yt-dash-manifest-generator-1.1.0.tgz#53d83ff2f2fc4cb2a17958674c264e66d465f7a7"
+  integrity sha512-D/bcjKAqtj6GG5swNGrv1Ene/TgkIdTo5qGYjBZpcXTEaNDxeo5+7a8exJz1qatv72JeGAI++uEs6SjAlSPkDw==
+  dependencies:
+    xml-js "^1.6.11"
+    ytdl-core "^3.2.2"
+
 "@humanwhocodes/config-array@^0.5.0":
   version "0.5.0"
   resolved "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.5.0.tgz"
@@ -9056,14 +9064,6 @@ yt-channel-info@^3.0.3:
   dependencies:
     axios "^0.26.1"

-yt-dash-manifest-generator@1.1.0:
-  version "1.1.0"
-  resolved "https://registry.npmjs.org/yt-dash-manifest-generator/-/yt-dash-manifest-generator-1.1.0.tgz"
-  integrity sha512-kLYeroH5LmdlvoRf4PrYyzgR5+tFaB1COSsLOjKHPnDvHQ+0Vp+c258TYR0WQp2RNpW57DYci9WG3O8+b1FQzQ==
-  dependencies:
-    xml-js "^1.6.11"
-    ytdl-core "^3.2.2"
-
 yt-trending-scraper@^2.0.1:
   version "2.0.1"
   resolved "https://registry.npmjs.org/yt-trending-scraper/-/yt-trending-scraper-2.0.1.tgz"
efb4f5ff-1298-471a-8973-3d47447115dc commented 2 years ago

Isnt this also related to https://github.com/FreeTubeApp/FreeTube/issues/885

https://github.com/FreeTubeApp/FreeTube/issues/885#issuecomment-1101282562

absidue commented 2 years ago

That looks like it's unrelated as FreeTube currently uses the working package. That error is likely because the URLs to the audio and video files that YouTube provides expire after 6 hours.

absidue commented 2 years ago

Additionally both of those users are using Windows 7 which is so old that it probably doesn't have support for most of the codecs and formats that YouTube provides.