vlc custom user agent no longer working

Microsoft Windows specific usage questions
Forum rules
Please post only Windows specific questions in this forum category. If you don't know where to post, please read the different forums' rules. Thanks.
elitedata
Blank Cone
Blank Cone
Posts: 58
Joined: 20 Jan 2022 20:17

vlc custom user agent no longer working

Postby elitedata » 13 Mar 2022 20:36

windows 11 64bit - vlc 3.0.16 vetinari 64bit
despite the command entered in the desktop shortcut target or manually entered in command prompt, only "referrer" is actually working, not the user agent, vlc is reporting the user agent as "VLC/3.0.16 LibVLC/3.0.16" when it should be reporting the user agent as ""Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:98.0) Gecko/20100101 Firefox/98.0".
this was working previously until the PC was rebooted.
app and user permissions for VLC are set to Administrator.
i have tried various changes to restore this to no avail.
desktop shortcut target properties:

Code: Select all

"C:\Program Files\VideoLAN\VLC\vlc.exe" --http-user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:98.0) Gecko/20100101 Firefox/98.0" --http-referrer="https://vaughn.live"
log file:
http://scpdny.com/vlc-log.txt

Rémi Denis-Courmont
Developer
Developer
Posts: 15228
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: vlc custom user agent no longer working

Postby Rémi Denis-Courmont » 13 Mar 2022 21:26

You probably meant :http-user-agent, and no, the behaviour has not changed on reboot.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

elitedata
Blank Cone
Blank Cone
Posts: 58
Joined: 20 Jan 2022 20:17

Re: vlc custom user agent no longer working

Postby elitedata » 13 Mar 2022 21:29

I'll try that format.
i used -- as a global command and it was working but not since a pc reboot.

elitedata
Blank Cone
Blank Cone
Posts: 58
Joined: 20 Jan 2022 20:17

Re: vlc custom user agent no longer working

Postby elitedata » 13 Mar 2022 22:39

changing the command format from -- to :, makes no difference.
i tried various combinations and orders of using --, - and : in command prompt and desktop shortcut target, to no avail.
currently, seeing if this may have to do with the settings file itself since it appears this issue began when creating a playlist from the domain in question (im not using the playlist to execute vlc as this would create this issue but it appears to be related somehow)

elitedata
Blank Cone
Blank Cone
Posts: 58
Joined: 20 Jan 2022 20:17

Re: vlc custom user agent no longer working

Postby elitedata » 13 Mar 2022 22:49

removing the commands from the desktop shortcut and placing the commands into the vlcrc setting file also makes no difference.
the same exact scenario happens, user agent is reported as vlc but referrer is reported correctly.

section of the vlcrc setting file:

# User agent (string)
http-user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:98.0) Gecko/20100101 Firefox/98.0"
http-referrer="https://vaughn.live"
simulation of deletion of preferences and caches by renaming the respective folders with a"1" added to the existing name also makes no difference.

elitedata
Blank Cone
Blank Cone
Posts: 58
Joined: 20 Jan 2022 20:17

Re: vlc custom user agent no longer working

Postby elitedata » 13 Mar 2022 23:09

also, tried this in windows sandbox, installed 64 bit version of 3.0.16, tried the command settings for each: commands appended to the desktop shortcut target properties, commands appended after executing vlc in command prompt and adding them to the vlcrc setting file - still have the same result as previous.
tried the 32 bit version of VLC in a new session of sandbox, same result.
this issue completely befuddles me.
i can reproduce this using a sandbox and on another windows 11 64bit PC.
why would this work the first time on 3/12 when it was first initiated (appending the command to the desktop shortcut target) and stop working on 3/13 when the pc was rebooted ?
i tried different MRL's and even changed the user agent and referrer to "foobar", it only reported "foobar" for the referrer while user agent still reported VLC.
also tried 64bit 3.0.17.3 vetinari, same result.
added to note for version 3.0.17.3 vetinari (likely applies to 3.0.16 vetinari):
removing all user agent and referrer methods results in the default user agent behavior but, adding this (edit options) as shown in the attached picture...
Image
results in no user agent being reported at all

Code: Select all

http debug: outgoing request: GET /play/live_docbrown1.flv HTTP/1.1 Host: stream-cdn.vaughnsoft.net Accept: */* Accept-Language: en_US Range: bytes=0-

elitedata
Blank Cone
Blank Cone
Posts: 58
Joined: 20 Jan 2022 20:17

Re: vlc custom user agent no longer working

Postby elitedata » 14 Mar 2022 02:00

manually hex-editing vlc.exe and replacing VLC/3.0.17.3 with"Mozilla/5.0." (same 12 characters) shows the user agent as entered.
Image
this simply doesnt work when using the http-user-agent command, i surely cannot be the only one with this issue.

elitedata
Blank Cone
Blank Cone
Posts: 58
Joined: 20 Jan 2022 20:17

Re: vlc custom user agent no longer working

Postby elitedata » 14 Mar 2022 04:43

im able to get this to work as intended using the "edit options" under "open network stream" but this is not persistent each time the MRL is changed and when vlc is executed.
to make this persistent, requires a playlist created with each MRL to have the user agent and referrer in "edit options".
a PITA and time consuming to do it this way since the global --http-user-agent option during vlc execution doesnt appear to work.
cautionary tale to remove ":network-caching=xxxx" from "edit options" otherwise it is added twice to the saved playlist file due to network caching already being present in settings.
perhaps an added option in the future to make the "edit options" persistent across all MRL's could be added.

Rémi Denis-Courmont
Developer
Developer
Posts: 15228
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: vlc custom user agent no longer working

Postby Rémi Denis-Courmont » 14 Mar 2022 09:33

Again, this is not caused by reboot. The behaviour has been the same since at least VLC 3.0.0. Anybody can verify this easily.

The colon syntax works fine here, just needs to come after the item MRL (as all colon options do).
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

Lotesdelere
Cone Master
Cone Master
Posts: 9881
Joined: 08 Sep 2006 04:39
Location: Europe

Re: vlc custom user agent no longer working

Postby Lotesdelere » 14 Mar 2022 10:24

Code: Select all

vlc.exe "https://domain.com/index.m3u8" :http-user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:98.0) Gecko/20100101 Firefox/98.0"

This definitely works for me. Notice the user agent is placed at the end of the command line.

elitedata
Blank Cone
Blank Cone
Posts: 58
Joined: 20 Jan 2022 20:17

Re: vlc custom user agent no longer working

Postby elitedata » 14 Mar 2022 12:42

Code: Select all

vlc.exe "https://domain.com/index.m3u8" :http-user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:98.0) Gecko/20100101 Firefox/98.0"

This definitely works for me. Notice the user agent is placed at the end of the command line.
your example is for the MRL "edit options", that works as intended.
what im specifying is different:

the below example does not work as intended, its executed as shown in the desktop shortcut target properties or through command line execution.
only "referrer" actually works as intended, user agent is sent as vlc.

desktop shortcut using -- (no changes when using : or command line execution)

Code: Select all

"C:\Program Files\VideoLAN\VLC\vlc.exe" --http-user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:98.0) Gecko/20100101 Firefox/98.0" --http-referrer="https://vaughn.live"
previously, the above code *did* work, when vlc was executed and any network MRL entered, it would always send the user agent and referrer that was specified, it did not have to be manually entered into "edit options" per each network MRL, this made it quite easy to copy/paste the URL from the specified domain using "downloadhelper" in firefox.

generally, with those options added after execution, that should tell vlc to startup with those specified parameters (user agent and referrer) and remain that way unless changed otherwise.
instead, what actually remains after initial execution, is the referrer, the user agent is always sent as vlc and not as specified.
edited to add:
vlc will not play any of the live streaming videos specified on that domain (vaughn.live) using non-web browser user agents.

Lotesdelere
Cone Master
Cone Master
Posts: 9881
Joined: 08 Sep 2006 04:39
Location: Europe

Re: vlc custom user agent no longer working

Postby Lotesdelere » 14 Mar 2022 14:15

The syntax that works is :http-user-agent="" and not --http-user-agent="" and it must be placed at the end of the command line.

elitedata
Blank Cone
Blank Cone
Posts: 58
Joined: 20 Jan 2022 20:17

Re: vlc custom user agent no longer working

Postby elitedata » 14 Mar 2022 14:43

The syntax that works is :http-user-agent="" and not --http-user-agent="" and it must be placed at the end of the command line.
this has been done and i get the same results - VLC will send the specified referrer but not the specified user agent.
demonstration video:
https://youtu.be/0CF-czjvnzM

Rémi Denis-Courmont
Developer
Developer
Posts: 15228
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: vlc custom user agent no longer working

Postby Rémi Denis-Courmont » 14 Mar 2022 14:55

AGAIN: it works if you put the option after the MRL to which it applies. As for every other colon option.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

elitedata
Blank Cone
Blank Cone
Posts: 58
Joined: 20 Jan 2022 20:17

Re: vlc custom user agent no longer working

Postby elitedata » 14 Mar 2022 15:04

right, i get that - what i am seeking, is for VLC to have its user agent and referrer set upon execution of the program and not having to set the user agent and referrer every time i enter an MRL into VLC - this is outlined in the VLC commands wiki, that you should be able to do this and at one point, it *did* work.
i am not able to do this now though i was able to do this previously.
this is akin to manually setting the user agent in firefox - it stays this way until you change it.
how about adding a text field entry option in the settings GUI ?
one text field entry as "user agent" and the next text field entry as "referrer".
these fields can be left blank for the default action or entered for a custom action.
if this was available, it would make things super easy for me and anyone else who uses VLC to watch live streaming videos where any user agent other than accepted web browsers and referrers from the same domain, are blocked.
the specific domain i am trying to use VLC on, blocks any user agent other than well known web browser agents AND blocks referrers from any domain other than its own, so both must be used in order to stream content from that domain - because of two domains being used, stream content domain is stream-cdn.vaughnsoft.net and the referrer domain is vaughn.live

this can be reproduced on windows 10/11:
change the desktop shortcut properties to (again, it does not matter if "--" or ":" is used, you get the same result):

Code: Select all

"C:\Program Files\VideoLAN\VLC\vlc.exe" :http-user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:98.0) Gecko/20100101 Firefox/98.0" :http-referrer="https://vaughn.live"
open vlc, select messages window to verbosity 2, open network stream and enter this:

Code: Select all

https://stream-cdn.vaughnsoft.net/play/live_b_o_t.flv
observe the messages window and see that the user agent is not as specified as intended but the referrer is specified as intended.

the *only* way i can get this to work as intended is by making a playlist (or manually entering these options every time under "edit options" for the MRL):
http://scpdny.com/test.xspf

Code: Select all

<?xml version="1.0" encoding="UTF-8"?> <playlist xmlns="http://xspf.org/ns/0/" xmlns:vlc="http://www.videolan.org/vlc/playlist/ns/0/" version="1"> <title>Playlist</title> <trackList> <track> <location>https://stream-cdn.vaughnsoft.net/play/live_b_o_t.flv</location> <extension application="http://www.videolan.org/vlc/playlist/0"> <vlc:id>0</vlc:id> <vlc:option>network-caching=1000</vlc:option> <vlc:option>http-user-agent=&quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:98.0) Gecko/20100101 Firefox/98.0&quot;</vlc:option> <vlc:option>http-referrer=&quot;https://vaughn.live&quot;</vlc:option> </extension> </track> </trackList> <extension application="http://www.videolan.org/vlc/playlist/0"> <vlc:node title="vaughn.xspf"> <vlc:item tid="0"/> </vlc:node> </extension> </playlist>
if i want to add another stream from this domain to this playlist, i *have* to add the following every single time with each new MRL:

Code: Select all

:http-user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:98.0) Gecko/20100101 Firefox/98.0" :http-referrer="https://vaughn.live"
so i have resulted to using a notepad file with this option content to copy/paste it into "edit options" for the MRL (why should i have to go through these steps every time, to add a stream to the playlist or to play a stream from this domain ?)
Last edited by elitedata on 14 Mar 2022 15:49, edited 1 time in total.

Rémi Denis-Courmont
Developer
Developer
Posts: 15228
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: vlc custom user agent no longer working

Postby Rémi Denis-Courmont » 14 Mar 2022 15:48

AGAIN, AGAIN, all colon options apply to the previous item. That's the whole point really.

If you want to change the UA string globally, use the API (as stated in the wiki page of the old HTTP module, by the way).

It doesn't make much sense to do that from CLI since it would affect literally every HTTP uses, as opposed to those few URLs that need whatever you've set.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

elitedata
Blank Cone
Blank Cone
Posts: 58
Joined: 20 Jan 2022 20:17

Re: vlc custom user agent no longer working

Postby elitedata » 14 Mar 2022 15:55

AGAIN, AGAIN, all colon options apply to the previous item. That's the whole point really.

If you want to change the UA string globally, use the API (as stated in the wiki page of the old HTTP module, by the way).

It doesn't make much sense to do that from CLI since it would affect literally every HTTP uses, as opposed to those few URLs that need whatever you've set.
ok, forget it and thanks anyway.
ill just stick to using notepad and copy/paste the options to "edit options" of the MRL and create a playlist with those *stored" options *every single time i enter a URL from that domain*.
there are some of us who would prefer to set the user agent and referrer in VLC globally (see my GUI suggestion comment), it should not have to be a "hop-scotch" game to do it through an API since i already previously stated earlier (many times), that setting these global options in the CLI also produces the same result as the desktop shortcut (as demonstrated): user agent is not specified as intended BUT the referrer is specified as intended.
thanks anyway.
you say it would literally affect "literally every HTTP uses" but i digress, there can only be a positive net effect and not a negative net effect by globally changing the user agent of VLC to that of a web browser (for all sessions), since its well known that many streaming services depend on a web browser to deliver the media content and do *not* advocate or allow the use of external media players to view their streaming content for several reasons i note below.
despite the fact that many of these streaming services are providing content illegally (there are plenty of sites), but are yet profiteering from the revenue of often malicious ad-popups, in-line ads and video commercials, in a very hypocritical manner (yes, you can use adblock/ublock/noscript but wouldnt you prefer using VLC instead ?)
yet, it seems like its "pulling teeth" just to get VLC to send-out a custom user agent during all sessions of execution, instead of manually and laboriously having to enter these options after *every MRL* to avoid this nonsense as well as avoiding poorly designed websites that are resource intensive with malicious scripts and an in-line browser media player that is configured improperly, as well as correcting the aspect ratio of content displayed incorrectly, need i say more ?
im sure lots of folks would agree with me about these statements.

Lotesdelere
Cone Master
Cone Master
Posts: 9881
Joined: 08 Sep 2006 04:39
Location: Europe

Re: vlc custom user agent no longer working

Postby Lotesdelere » 15 Mar 2022 13:47

how about adding a text field entry option in the settings GUI ?
one text field entry as "user agent" and the next text field entry as "referrer".

The user agent option was there in the settings of the GUI but it has been removed years ago, and not only from the GUI but also from the settings config files. The option line is still there but it's ignored.
https://forum.videolan.org/viewtopic.php?f=14&t=99636


what i am seeking, is for VLC to have its user agent and referrer set upon execution of the program and not having to set the user agent and referrer every time i enter an MRL into VLC

What you're trying to achieve is exactly the reason why I'm now using another player for these purposes, a player which can store these settings because it's a pain to have to type and to use a command line every time.

elitedata
Blank Cone
Blank Cone
Posts: 58
Joined: 20 Jan 2022 20:17

Re: vlc custom user agent no longer working

Postby elitedata » 15 Mar 2022 17:12

how about adding a text field entry option in the settings GUI ?
one text field entry as "user agent" and the next text field entry as "referrer".

The user agent option was there in the settings of the GUI but it has been removed years ago, and not only from the GUI but also from the settings config files. The option line is still there but it's ignored.
https://forum.videolan.org/viewtopic.php?f=14&t=99636


what i am seeking, is for VLC to have its user agent and referrer set upon execution of the program and not having to set the user agent and referrer every time i enter an MRL into VLC

What you're trying to achieve is exactly the reason why I'm now using another player for these purposes, a player which can store these settings because it's a pain to have to type and to use a command line every time.
nice to know and thanks for pointing that out, i see i was not the only one.
i should have been told about this option being "private" on my first post but i wasnt, so whatever.
i suspected this to be the case originally, that this option was being ignored but it was the command line wiki that constantly threw me off into believing that this global option should work since "referrer" works but not "user agent".
still, i am befuddled as to why it worked the first time until i re-booted my pc :?:
i'll continue to use the MRL options, manually enter them from a saved notepad file and then save the MRL's to a playlist.
as tedious as it may be, it works and thats all i care about.
at least with this method, i can skip through each stream in the playlist like changing channels on a television.
i hope future releases of VLC do not eliminate this last and final option to change the user agent.
thanks.

Rémi Denis-Courmont
Developer
Developer
Posts: 15228
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: vlc custom user agent no longer working

Postby Rémi Denis-Courmont » 15 Mar 2022 21:15

The easiest (as in automated) way to fix this for a specific website is to write a Lua plugin.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

palacs
New Cone
New Cone
Posts: 2
Joined: 02 Dec 2023 16:07

Re: vlc custom user agent no longer working

Postby palacs » 02 Dec 2023 16:11

I have the same issue with latest VLC 3.5.4 on Android using LibVLC 3.0.18. While :http-user-agent works on Linux (command line), neither :http-user-agent, nor --http-user-agent works on Android after specified at Settings > Advanced > Custom libVLC options. So literally on Android there is no way to alter HTTP User Agent.

How is this unfixed for more than a year?

Rémi Denis-Courmont
Developer
Developer
Posts: 15228
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: vlc custom user agent no longer working

Postby Rémi Denis-Courmont » 02 Dec 2023 16:29

Actually it works the same on the Android command line, with the "proper" VLC executable as it does on the command line of a normal Linux. It's just that people don't typically build and use VLC on the command line on Android.

As for why the VLC :http-user-agent option does not work on the Android GUI app, that's simple: the GUI app is not VLC. It's a completely separate Android-specific app from VLC proper, that just happens to use LibVLC to play media files.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

palacs
New Cone
New Cone
Posts: 2
Joined: 02 Dec 2023 16:07

Re: vlc custom user agent no longer working

Postby palacs » 02 Dec 2023 18:16

As for why the VLC :http-user-agent option does not work on the Android GUI app, that's simple: the GUI app is not VLC. It's a completely separate Android-specific app from VLC proper, that just happens to use LibVLC to play media files.

--http-user-agent is a libVLC option. The Android GUI app even validates custom libVLC options specified and it finds both --http-user-agent and :http-user-agent valid, it's just libVLC doesn't seem to do anything with it. Since changing the HTTP User-Agent is a libVLC feature, it should work on Android even if the GUI is a frontend different from the one on desktop. As --http-user-agent should also work both in Windows/Linux/Mac command line and specified from the desktop GUI in both formats.

There are a few stream providers who block VLC and only VLC by its HTTP User-Agent and there is no chance without this option to watch these using VLC. Now I had to download Next Player from F-Droid just because it's not VLC, so it's allowed by the stream provider. It's so dumb it can't even bookmark streams. So had to create a shortcut for all these tricky streams using QuickShortcutMaker. It could've been simply in VLC if User-Agent had been set properly by specifying the libVLC option.

Asking again: When are you going to fix this? On Android and desktop as well?

Rémi Denis-Courmont
Developer
Developer
Posts: 15228
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: vlc custom user agent no longer working

Postby Rémi Denis-Courmont » 02 Dec 2023 20:24

--http-user-agent is a libVLC option.
No it is not.

There is a media item option for VLC playlist items ":http-user-agent". Note the different prefix. That option works in VLC proper, as well as in potentially any application dealing with VLC playlist items. The Android GUI app is not one of those apps. It has its own internally playlist and media library completely separate from LibVLC.

If the Android GUI app pretends that the option exists, then that's a bug in the Android GUI app. You will note that this is a forum for desktop VLC, specifically Windows VLC - not the Android app.

And again, the intended way to support providers that require specific UA fields, is to write Lua plugins for them, not to expect users to go and fiddle with advanced options manually every time.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded


Return to “VLC media player for Windows Troubleshooting”

Who is online

Users browsing this forum: No registered users and 90 guests