kevinf100 / tuberepair.uptimetrackers.com

Custom YouTube server written in python, for the old AppStore and classic iOS YouTube apps.
3 stars 2 forks source link

Clicking "More Videos" on a video's more info causes an internal error. #15

Open Preloading opened 4 days ago

Preloading commented 4 days ago

No clue if I should be posting it here, but i'm using this repo. I am running this through docker, and connecting from an iPhone 3G running iOS 4.2.1 thru the classic youtube app. No clue if ios 4.2.1 is actually supported but oh well.


Traceback (most recent call last):
  File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 1473, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 882, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 880, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/flask/app.py", line 865, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tuberepair-python/api/video.py", line 222, in get_suggested
    return get.template('classic/search.jinja2',{
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tuberepair-python/modules/get.py", line 53, in template
    output = t.render(render_data)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/jinja2/environment.py", line 1304, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.11/dist-packages/jinja2/environment.py", line 939, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "templates/classic/search.jinja2", line 23, in top-level template code
    <published>{{unix(info['published'])}}</published>
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tuberepair-python/modules/get.py", line 16, in unix
    return datetime.fromtimestamp(int(unix)).isoformat() + '.000Z'
                                  ^^^^^^^^^
jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'published'```
Preloading commented 3 days ago

A few more things after digging into it.

  1. In the /api/v1/videos/{video_id}'s recommended videos, it does not contain the release date of the video
  2. When you force the date, it just crashes
kevinf100 commented 1 day ago

Hmm. I wonder if it's not getting a second page for Classic. Maybe Classic isn't sending what I expect to get another page? This happens when Data isn't formatted how I expect or contains an error.

In the /api/v1/videos/{video_id}'s recommended videos, it does not contain the release date of the video

It just doesn't return it. Not much we can do about it besides doing an API call for every video. Not worth doing 10-30 request per search. https://docs.invidious.io/api/#get-apiv1videosid

When you force the date, it just crashes

The app really loves to crash when you send invalid Data. I just set to UTC 0 when No date is given.
Example <published>{{'published' in info and unix(info['published']) or unix('0')}}</published>
<yt:uploaded>1969-12-31T12:33:58.000Z</yt:uploaded>

Preloading commented 1 day ago

The app really loves to crash when you send invalid Data. I just set to UTC 0 when No date is given.

Looking and the example you provided, you need to put the actual date, while I just just sending the unix timestamp (since I thought that's what unix() did). That's probably why it crashed.

kevinf100 commented 1 day ago

The app really loves to crash when you send invalid Data. I just set to UTC 0 when No date is given.

Looking and the example you provided, you need to put the actual date, while I just just sending the unix timestamp (since I thought that's what unix() did). That's probably why it crashed.

That's would be why. unix timestamp would make more sense and be you know, more stable but whatever. This is years old code/app we are talking about.