API - Sending a YouTube URL through stream/hls request?

Need help? Post your questions here.

Moderator: moderators

API - Sending a YouTube URL through stream/hls request?

Postby Azkatro » Sun Oct 20, 2019 1:21 am

My eyes lit up when I realised youtube-dl (https://github.com/ytdl-org/youtube-dl/) supports streaming a YouTube video to stdout.

I was able to test it successfully in my html player by hardcoding a video URL in the transcoding string (youtube-dl.exe resides in C:\subsonic\transcode):

youtube-dl -o - 8MvtcsMAQtw

When activated, the above transcoding flawlessly streams the video to the browser.

So all I need to be able to do is specify the video URL portion (which is always letters and numbers) through the stream request. However, I've tried doing it via maxBitRate (must be numeric), size (must be numeric), etc.

I also looked into the possibility of autonomously updating the transcoding string through the API, but it doesn't allow that.

Does anybody have any ideas as to how I could achieve it?
Azkatro
 
Posts: 9
Joined: Thu Sep 05, 2019 3:01 am

Re: API - Sending a YouTube URL through stream/hls request?

Postby Azkatro » Mon Oct 21, 2019 1:08 am

The good news is I figured out a workaround.

You can utilise [server_url]/db.view to update the transcoding command. However, because db.view is restricted, it doesn't work from outside [server_url] - even if you're authenticated.

This is because the required Access-Control-Allow-Origin header doesn't get set. In the file applicationContext-security.xml, this exists:

Code: Select all
                /login.view=IS_AUTHENTICATED_ANONYMOUSLY
                /recover.view=IS_AUTHENTICATED_ANONYMOUSLY
                /accessDenied.view=IS_AUTHENTICATED_ANONYMOUSLY
                /coverArt.view=IS_AUTHENTICATED_ANONYMOUSLY
                /captions.view=IS_AUTHENTICATED_ANONYMOUSLY
                /hls/**=IS_AUTHENTICATED_ANONYMOUSLY
                /segment/**=IS_AUTHENTICATED_ANONYMOUSLY
                /stream/**=IS_AUTHENTICATED_ANONYMOUSLY
                /ws/**=IS_AUTHENTICATED_ANONYMOUSLY
                /share/**=IS_AUTHENTICATED_ANONYMOUSLY
                /style/**=IS_AUTHENTICATED_ANONYMOUSLY
                /fonts/**=IS_AUTHENTICATED_ANONYMOUSLY
                /icons/**=IS_AUTHENTICATED_ANONYMOUSLY
                /flash/**=IS_AUTHENTICATED_ANONYMOUSLY
                /script/**=IS_AUTHENTICATED_ANONYMOUSLY
                /sonos/**=IS_AUTHENTICATED_ANONYMOUSLY
                /crossdomain.xml=IS_AUTHENTICATED_ANONYMOUSLY

                /personalSettings.view=ROLE_SETTINGS
                /passwordSettings.view=ROLE_SETTINGS
                /playerSettings.view=ROLE_SETTINGS
                /shareSettings.view=ROLE_SETTINGS

                /generalSettings.view=ROLE_ADMIN
                /advancedSettings.view=ROLE_ADMIN
                /userSettings.view=ROLE_ADMIN
                /musicFolderSettings.view=ROLE_ADMIN
                /networkSettings.view=ROLE_ADMIN
                /dlnaSettings.view=ROLE_ADMIN
                /sonosSettings.view=ROLE_ADMIN
                /transcodingSettings.view=ROLE_ADMIN
                /internetRadioSettings.view=ROLE_ADMIN
                /podcastSettings.view=ROLE_ADMIN
                /db.view=ROLE_ADMIN

                /deletePlaylist.view=ROLE_PLAYLIST
                /savePlaylist.view=ROLE_PLAYLIST

                /download.view=ROLE_DOWNLOAD

                /upload.view=ROLE_UPLOAD

                /createShare.view=ROLE_SHARE

                /changeCoverArt.view=ROLE_COVERART
                /editTags.view=ROLE_COVERART

                /setMusicFileInfo.view=ROLE_COMMENT

                /podcastReceiverAdmin.view=ROLE_PODCAST

                /**=IS_AUTHENTICATED_REMEMBERED


If I change /db.view=IS_AUTHENTICATED_ANONYMOUSLY, it works (it errors, but still allows me to run the query).

Of course this option isn't an option because that would result in db.view being completely open.

So I realise this is a really specific and quirky question, but.. is it possible to make the server set a value for Cross-Domain requests in the HTTP headers? Even if it's not *, I would like to be able to set it for a specific domain (or domains) for pages that have the ROLE_ADMIN requirement.

Or, preferably, to be able to send a custom value through the /rest/stream request!

Any ideas or help would be greatly appreciated, as I have no real knowledge of the server architecture.
Azkatro
 
Posts: 9
Joined: Thu Sep 05, 2019 3:01 am


Return to Help

Who is online

Users browsing this forum: No registered users and 10 guests