Compile-Time / yt-quick-actions

MIT License
9 stars 2 forks source link

[Feature idea] Add a "Watch later" button for YT Shorts #3

Closed StefanTirea closed 1 year ago

StefanTirea commented 1 year ago

Currently there is no easy way to add a Youtube Shorts video to a playlist. My idea would be to add a button in the actions row or in the dropdown where the video can be added to the watch later playlist via one click.

Current UI of YT Shorts + possible locations: image

Compile-Time commented 1 year ago

Hi, overall this idea would fit very well into the extension. However, it might take some time to get this to work or at worst it might not be possible to implement. Currently, the extension re-uses actions that already exists on a page which allows it to function without any API keys. Since shorts do not have a watch later action present, a new approach needs to be determined.

I have a rough idea in mind on how to maybe solve this, however, it will take some time.

StefanTirea commented 1 year ago

Ok, looked into possible solutions:

Youtube Data API: For this the user has to login with a google account so the extension can work on behalf the user (OAuth2). However, an API key is also required, which is rate limited to 10 000 units. Inserting a video into a playlist costs 50 units. Therefore, only 200 requests would be possible, which will quickly break when more than 30 users are using this feature. So this approach would not work if you don't want to pay for a higher quota.

Trigger actions via the website: Similar to your approach, use the website itself to trigger actions. I reverse engineered how videos are added to playlists:

The best approach that worked for me is to use a different action, for example the LIKE video action, and catch + mutate this request to contain all the playlist information. Following must be changed for a working solution:

I will try to implement a working prototype for your extension in the coming days.

Compile-Time commented 1 year ago

As discussed outside of Github: This feature would require some solution where we would manipulate the HTTP request of a different action to trigger our desired operation. Furthermore, the webRequest API needs to be used to perform HTTP request manipulation which is very limited in Google's proposed manifest 3 implementation for Chrome.

So we would end up with a Firefox exclusive feature that will probably use a very hacky solution. Due to the circumstances, I will not follow up on this idea.