accumulator / Quickddit

Reddit client for Jolla's SailfishOS, Ubuntu Touch and Nokia N9
GNU General Public License v3.0
53 stars 21 forks source link

Add Python function for testing YTDL url support #88

Open rubdos opened 2 years ago

rubdos commented 2 years ago

untested, wip

accumulator commented 2 years ago

The main reason I haven't hooked it up to YTDL yet is speed (it would query YTDL's python code for every post in the list)

rubdos commented 2 years ago

The main reason I haven't hooked it up to YTDL yet is speed (it would query YTDL's python code for every post in the list)

Yeh, I already thought that might've been a problem. I'll test it out when I figure out how to get the API keys and secrets done. I'll probably try to come up with a faster way if it's indeed slow the way I did it now.

rubdos commented 2 years ago

Got around to testing this a bit:

  1. It's indeed noticeably introducing lag during scrolling
  2. The Python module is not loaded when the first requests are fired for the function, throwing a few of these:
[D] unknown:0 - "PyOtherSide error: Traceback (most recent call last):\n\n  File \"<string>\", line 1, in <module>\n\nNameError: name 'ytdl_wrapper' is not defined\n"
[D] onError:73 - python error: Function not found: 'ytdl_wrapper.isVideoUrlSupported' (Traceback (most recent call last):

  File "<string>", line 1, in <module>

NameError: name 'ytdl_wrapper' is not defined
)
  1. Seems like ytdl is now also going for imgur and i.reddit images, overruling the decision that they are images.
accumulator commented 2 years ago

It might be useful though to lazily check a link when opening the comments page for a post. That would allow more videos to be played, just not directly from a subreddit view.

However, there's a second part to all this, which is the extraction of a suitable media url from the info datastructure returned from ytdl. See https://github.com/accumulator/Quickddit/blob/065c49d5212301669e676f2a5dfa110b265f6b21/sailfish/qml/VideoViewPage.qml#L222-L227 It is not uniform across video sites. There is an option in ytdl to pass video selection criteria, which might alleviate this issue, but I've never looked deeper into it.