Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Youtube-local doesn't work for some videos, mainly music videos #218

Open
tenextractor opened this issue Oct 19, 2024 · 8 comments · May be fixed by #219
Open

Youtube-local doesn't work for some videos, mainly music videos #218

tenextractor opened this issue Oct 19, 2024 · 8 comments · May be fixed by #219

Comments

@tenextractor
Copy link

Trying to open https://www.youtube.com/watch?v=kJQP7kiw5Fk for example, gives this error:

Traceback (most recent call last):
  File "...youtube-local/venv/lib/python3.11/site-packages/flask/app.py", line 1455, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...youtube-local/venv/lib/python3.11/site-packages/flask/app.py", line 869, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...youtube-local/venv/lib/python3.11/site-packages/flask/app.py", line 867, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "...youtube-local/venv/lib/python3.11/site-packages/flask/app.py", line 852, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...youtube-local/youtube/watch.py", line 647, in get_watch_page
    url = info['formats'][0]['url']
          ~~~~~~~~~~~~~~~^^^
IndexError: list index out of range```
@alive4ever
Copy link

Hi, I encountered similar problem and prepared a few changes in the feature-innertube-client-fix branch of my fork

Let me know if my changes solve this issue.

@alive4ever alive4ever linked a pull request Oct 28, 2024 that will close this issue
@tenextractor
Copy link
Author

@alive4ever Yes, your changes solved it. Thanks.

@nakrosrex
Copy link

Hi, I encountered similar problem and prepared a few changes in the feature-innertube-client-fix branch of my fork

Let me know if my changes solve this issue.

Hey thanks for this the problem has been solved by using your changes can you please resolve the playlist issue described here #220

@arborealoctopus
Copy link

another confirmation your changes solve the music vid problem, thank you very much.

for those on windows who are building themselves, note that fake-useragent (a new dependency introduced in this fix) doesn't seem to work properly with how this tool is built. In the fake-useragent file settings.py it returns importlib.metadata.PackageNotFoundError which seems to be a result of not "properly" installing the package (tbh I don't know how the build system works on this project, so "proper" may be the wrong word). I poked around a little bit but couldn't figure out how to fix this, so I ended up just hard-coding the addon version as a constant (settings.py line 7). Works great now.

thanks again

@arborealoctopus
Copy link

arborealoctopus commented Nov 3, 2024

Oh, I'm silly, I should have looked at the dist generator...its probably this:
image

confirmed, removing these lines makes a functional build ✅

@alive4ever
Copy link

Hi, sorry for the inconvenience. I don't test the generate_release.py script since I just run the web app manually on Debian.

python3.11 -m venv --upgrade-deps venv
pip install -r requirements.txt
source ./venv/bin/activate
python ./server.py

Currently doing a trial build to run generate_release.py via github action to find out if a release is possible with my proposed changes.

As for playlist page problem, I don't have a clue since I am focusing on the watch page, especially player extraction from yt-api response.

@alive4ever
Copy link

confirmed, removing these lines makes a functional build ✅

Hi, after several attempts of github actions, a release is possible without those changes (winehq stable, python 3.11.9). Look at releases section of my repo

The only required change is modifying branch name from master to HEAD

diff --git a/generate_release.py b/generate_release.py
index aed9d22..36d368b 100644
--- a/generate_release.py
+++ b/generate_release.py
@@ -92,7 +92,7 @@ if os.path.exists('./youtube-local'):
 # confused with working directory. I'm calling it the same thing so it will
 # have that name when extracted from the final release zip archive)
 log('Making copy of youtube-local files')
-check(os.system('git archive --format tar master | 7z x -si -ttar -oyoutube-local'))
+check(os.system('git archive --format tar HEAD | 7z x -si -ttar -oyoutube-local'))

 if len(os.listdir('./youtube-local')) == 0:
     raise Exception('Failed to copy youtube-local files')

@alive4ever
Copy link

alive4ever commented Nov 5, 2024

confirmed, removing these lines makes a functional build ✅

So I tested my own github action build and found that the issue is during runtime, not during build. Sorry for my ignorance in the previous reply.

I've added a commit in my pull-request to modify generate_release.py to not remove dist-info files so fake-useragent module can start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
@alive4ever @tenextractor @arborealoctopus @nakrosrex and others