Jump to content

M3U tuner: 403 Forbidden despite User-Agent and Referrer


Go to solution Solved by sa2000,

Recommended Posts

Posted

Hi again!

I'm trying to stream Cubavisión Internacional using this M3U file:

#EXTM3U
#EXTINF:10.000000,TVG-ID="Cubavisión Internacional" tvg-name="Cubavisión Internacional",Cubavisión Internacional
https://cdn.teveo.cu/live/video/A36pWmuWvZBQskuZ/ngrp:gppfydfzpSUn9Udy.stream/playlist.m3u8

Without any further config, I'm getting a popup saying "Forbidden" when trying to play the channel – so I set Referrer and User-Agent, and the PlaybackInfo API response confirms that the values are set:

"RequiredHttpHeaders": {
	"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0",
	"Referrer": "https://teveo.cu/"
}

When I check the HTTP headers directly on https://teveo.cu/live/video/AKDdWvMTYzfsfnNJ, I see that "Referer" is used, and "Referer" seems to be the correct misspelling according to https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer. Could it be that Emby sends the HTTP request with "Referrer" instead of "Referer"? (On that note: I think it would be great to be able to define custom HTTP headers, other than just Refer(r)er and User-Agent. Don't know if there's demand for that though.)

Btw: Setting the User-Agent and Referer headers seems to do the trick for this stream; this curl command works just fine:

curl 'https://cdn.teveo.cu/live/video/A36pWmuWvZBQskuZ/ngrp:gppfydfzpSUn9Udy.stream/playlist.m3u8' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0' -H 'Referer: https://teveo.cu/'

Thanks in advance!

embyserver.txt

Posted (edited)

Hi, "referrer" "referer" the correct spelling of the header.  EDIT: corrected answer as it was originally incorrect)

You're getting a Forbidden error code, which is normally associated with bad auth credentials or trying to access a stream that's using Geo-blocking. Your IP address is outside the GEO location allowed to view the stream. A VPN could help with this stream but may not or could cause issues with other streams. Many providers block known IPs of VPN services so depending on VPN, may not work. 

Also if you access streams from different areas that use Geo blocking then the VPN could cause issues with other channels.

Edited by Carlo
Posted
9 hours ago, Carlo said:

Hi, "referrer" is the correct spelling of the header.

You're getting a Forbidden error code, which is normally associated with bad auth credentials or trying to access a stream that's using Geo-blocking. Your IP address is outside the GEO location allowed to view the stream. A VPN could help with this stream but may not or could cause issues with other streams. Many providers block known IPs of VPN services so depending on VPN, may not work. 

Also if you access streams from different areas that use Geo blocking then the VPN could cause issues with other channels.

Hi, thanks, but I'm afraid this doesn't help.

Again: this ffmpeg command (from the same IP, no VPN whatsoever) works fine:

curl 'https://cdn.teveo.cu/live/video/A36pWmuWvZBQskuZ/ngrp:gppfydfzpSUn9Udy.stream/playlist.m3u8' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0' -H 'Referer: https://teveo.cu/'

…while this one (with the Referrer header written like that) does not:

curl 'https://cdn.teveo.cu/live/video/A36pWmuWvZBQskuZ/ngrp:gppfydfzpSUn9Udy.stream/playlist.m3u8' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0' -H 'Referrer: https://teveo.cu/'

 

10 hours ago, Carlo said:

Hi, "referrer" is the correct spelling of the header.

Yeah, but "Referer" is the correct misspelling, unless I'm reading the spec wrong? https://httpwg.org/specs/rfc9110.html#field.referer

Posted

You may have to keep playing with the values until you find something that your provider accepts.

Posted
1 hour ago, Luke said:

You may have to keep playing with the values until you find something that your provider accepts.

I'm confused. You mean values for User-Agent and Referer? I already found values that https://teveo.cu/ accepts; see the working curl example I posted.

Could you verify whether the M3U TV Tuner plugin sends the referrer header correctly as "Referer" (as misspelled by the HTTP spec) and not "Referrer"?

Posted
1 hour ago, sk222 said:

Could you verify whether the M3U TV Tuner plugin sends the referrer header correctly as "Referer" (as misspelled by the HTTP spec) and not "Referrer"

It is using Referrer

I am discussing this with @Luke

Posted

I just updated the M3U Tuner plugin, and it seems like the referer header isn't getting passed along to ffmpeg? (Still getting a 403 Forbidden, but on the ffmpeg level – the error message shown in Emby now reads "No compatible streams found"): There's the `-user_agent` ffmpeg command line switch getting logged, but nothing indicating the referrer being set.

	*** Error Report ***
	Version: 4.9.0.35
	Command line: /volume1/@appstore/EmbyServer/system/EmbyServer.dll -programdata /var/packages/EmbyServer/var -ffdetect /var/packages/EmbyServer/target/bin/ffdetect -ffmpeg /var/packages/EmbyServer/target/bin/ffmpeg -ffprobe /var/packages/EmbyServer/target/bin/ffprobe -nolocalportconfig -ignore_vaapi_enabled_flag -pidfile /var/packages/EmbyServer/var/EmbyServer.pid -defaultdirectory /volume1/Public -updatepackage emby-server-synology72_{version}_x86_64.spk -noautorunwebapp
	Operating system: Linux version 4.4.302+ (root@build5) (gcc version 12.2.0 (GCC) ) #72806 SMP Thu Sep 5 13:44:44 CST 2024
	OS/Process: x64/x64
	Framework: .NET 8.0.10
	Runtime: volume1/@appstore/EmbyServer/system/System.Private.CoreLib.dll
	Processor count: 2
	Data path: /var/packages/EmbyServer/var
	Application path: /volume1/@appstore/EmbyServer/system
	Emby.Server.MediaEncoding.Unified.Ffmpeg.FfRunException: Emby.Server.MediaEncoding.Unified.Ffmpeg.FfRunException: Cannot access a disposed object.
	Object name: 'Emby.Server.MediaEncoding.Unified.Ffmpeg.FfmpegRunner'.
	-loglevel +timing -y -print_graphs_file "/var/packages/EmbyServer/var/logs/ffmpeg-transcode-fce50201-9566-4499-a9e3-6d74a56fc913_1graph.txt" -copyts -start_at_zero -analyzeduration 3000000 -stream_loop -1 -noautorotate -user_agent "Mozilla/5.0 (X11; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0" -multiple_requests 1 -reconnect_on_network_error 1 -reconnect_on_http_error 5xx,4xx -reconnect_streamed 1 -reconnect_delay_max 8 -i "https://cdn.teveo.cu/live/video/A36pWmuWvZBQskuZ/ngrp:gppfydfzpSUn9Udy.stream/chunklist_b2530163.m3u8" -filter_complex "[v:0]yadif@f1=mode=send_frame:parity=auto:deint=all,scale@f2=width='trunc(min(max(iw,ih*dar),3840)/2)*2':height=trunc(ow/dar/2)*2,format@f3=pix_fmts=yuv420p[f3_out0]" -map [f3_out0] -map a:0 -sn -c:v:0 libx264 -maxrate:v:0 10000000 -bufsize:v:0 20000000 -pix_fmt:v:0 yuv420p -force_key_frames:v:0 "expr:if(isnan(prev_forced_t),eq(t,t),gte(t,prev_forced_t+3))" -preset:v:0 veryfast -profile:v:0 high -x264opts:v:0 "subme=0:me_range=4:rc_lookahead=10:partitions=none" -crf:v:0 23 -c:a:0 aac -ab:a:0 192000 -ac:a:0 2 -disposition:a:0 default -max_delay 5000000 -avoid_negative_ts disabled -f segment -map_metadata -1 -map_chapters -1 -segment_format mpegts -segment_list "/var/packages/EmbyServer/var/transcoding-temp/678274/678274.m3u8" -segment_list_type m3u8 -segment_time 00:00:03.000 -segment_list_entry_prefix hls/678274/ -segment_start_number 0 -individual_header_trailer 0 -write_header_trailer 0 -segment_write_temp 1 "/var/packages/EmbyServer/var/transcoding-temp/678274/678274_%d.ts"
	
	22:49:31.340 ffmpeg version 5.1-emby_2023_06_25_p2 Copyright (c) 2000-2022 the FFmpeg developers and softworkz for Emby LLC
	22:49:31.340   built with gcc 10.3.0 (crosstool-NG 1.25.0)
	22:49:31.340 Execution Date: 2025-01-13 22:49:31
	22:49:32.573 [https @ 0x20f23c0] HTTP error 403 Forbidden
	22:49:32.573 [https @ 0x20f23c0] Will reconnect at 0 in 0 second(s).
	22:49:33.825 [https @ 0x20f23c0] HTTP error 403 Forbidden
	22:49:33.825 [https @ 0x20f23c0] Will reconnect at 0 in 1 second(s).
	22:49:36.171 [https @ 0x20f23c0] HTTP error 403 Forbidden
	22:49:36.171 [https @ 0x20f23c0] Will reconnect at 0 in 3 second(s).
	
	
	 ---> System.ObjectDisposedException: Cannot access a disposed object.
	Object name: 'Emby.Server.MediaEncoding.Unified.Ffmpeg.FfmpegRunner'.
	   at Emby.ProcessRun.Runners.ProcessRunnerBase.Run(StartParams startParams)
	   at Emby.Server.MediaEncoding.Unified.Ffmpeg.FfRunnerBase.Start(String commandLineArgs)
	   at Emby.Server.MediaEncoding.Unified.Ffmpeg.FfmpegRunner.Start(String commandLineArgs, CancellationToken cancellationToken)
	   at Emby.Server.MediaEncoding.Api.BaseStreamingService.StartFfMpeg(StreamState state, String outputPath, CancellationToken cancellationToken, Boolean acquireResources)
	   --- End of inner exception stack trace ---
	   at Emby.Server.MediaEncoding.Api.BaseStreamingService.StartFfMpeg(StreamState state, String outputPath, CancellationToken cancellationToken, Boolean acquireResources)
	   at Emby.Server.MediaEncoding.Api.Hls.BaseHlsService.ProcessRequest(StreamState state, StreamRequest request)
	   at Emby.Server.MediaEncoding.Api.Hls.DynamicHlsService.Get(GetLiveHlsStream request)
	   at Emby.Server.Implementations.Services.ServiceController.GetTaskResult(Task task)
	   at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost httpHost, IServerApplicationHost appHost, IRequest httpReq, IResponse httpRes, IStreamHelper streamHelper, RestPath restPath, String responseContentType, CancellationToken cancellationToken)
	   at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, ReadOnlyMemory`1 urlString, ReadOnlyMemory`1 localPath, CancellationToken cancellationToken)
	Source: Emby.Server.MediaEncoding
	TargetSite: Void MoveNext()
	InnerException: System.ObjectDisposedException: Cannot access a disposed object.
	Object name: 'Emby.Server.MediaEncoding.Unified.Ffmpeg.FfmpegRunner'.
	Source: Emby.ProcessRun
	TargetSite: Boolean Run(Emby.ProcessRun.Common.StartParams)
	   at Emby.ProcessRun.Runners.ProcessRunnerBase.Run(StartParams startParams)
	   at Emby.Server.MediaEncoding.Unified.Ffmpeg.FfRunnerBase.Start(String commandLineArgs)
	   at Emby.Server.MediaEncoding.Unified.Ffmpeg.FfmpegRunner.Start(String commandLineArgs, CancellationToken cancellationToken)
	   at Emby.Server.MediaEncoding.Api.BaseStreamingService.StartFfMpeg(StreamState state, String outputPath, CancellationToken cancellationToken, Boolean acquireResources)

 

Posted

Could you get me a full embyserver log file with debug logging enabled and also include the ffmpeg log file showing this.

 

  • Solution
Posted

Thank You. I understand this is expected to be resolved in 4.9.0.36 beta. I have passed on the logs

 

  • Like 1
vdatanet
Posted (edited)

Since plugin M3UTuner was updated to 1.0.35, I get Forbiden when trying to play Live TV.

embyserver.txt

Edited by vdatanet
  • Agree 1
Posted (edited)
21 minutes ago, vdatanet said:

Since plugin M3UTuner was updated to 1.0.35, I get Forbiden when trying to play Live TV.

As far as I know, the only change was to switch from Referrer to Referer in the header of the requests. The request that is failing is this

2025-01-17 11:09:12.841 Info HttpClient: GET http://host3:8080/x_path1_x/x_path2_x/x_path3_x
2025-01-17 11:09:13.026 Info HttpClient: Http response 403 from http://host3:8080/x_path1_x/x_path2_x/x_path3_x after 185ms. Headers Server=nginx/1.26.1, Date=Fri, 17 Jan 2025 10:09:13 GMT, Connection=keep-alive

Would need to see what is being sent and if the issue is to do with the Referrer change - 

As this is http and not https, you should be able to see what the request and headers are, using tcpdump to capture. If there is a Referer parameter in the headers, you could experiemt using curl as was done by @sk222here to see if it is due to that

Edited by sa2000
Posted

Can you try entering a referer in the m3u setup? The default value if left blank is made to look like the Chrome browser.

I'm not sure if this should be our default or if it should just be null. But anyway, now that we made the change, your provider may be seeing a Referer value that it wasn't before.

Posted
I have the same problem and everything was fine before, this must be solved for me, it is very important to enjoy my IPTV and now it says forbidden!

 

Use el traductor , soy español use Emby desde hace más de 6 años , necesito que se corrija este error por favor hace días que no puedo ver mi IPTV!

Posted
15 hours ago, vdatanet said:

Since plugin M3UTuner was updated to 1.0.35, I get Forbiden when trying to play Live TV.

embyserver.txt 42.65 kB · 3 downloads

I have exactly the same problem! Everything used to work great! Please fix this or I'll have to leave Emby and I've been using it for 6 years, please!

Posted (edited)
15 hours ago, vdatanet said:

Since plugin M3UTuner was updated to 1.0.35, I get Forbiden when trying to play Live TV.

embyserver.txt 42.65 kB · 3 downloads

 

I have tested my m3u list again in Kodi, plex, vlc, tivimate, the m3u list works in all those applications.

After updating m3tunner in emby it stopped working.

The problem is with emby and I would like to continue using emby and not have to abandon it because of this.

Edited by alex553
Posted
7 hours ago, alex553 said:

I have tested my m3u list again in Kodi, plex, vlc, tivimate, the m3u list works in all those applications.

After updating m3tunner in emby it stopped working.

From other posts, I presume your server is running on a Synology NAS. Are you able to setup tcpdump on your NAS ? I would like to see the difference in the http request that is now sent by Emby Server in comparison to what the other applications that work are sending - so capturing the network packet that is getting 403 with Emby and working ok with the others. 

In version 1.0.35 we changed the Referrer to Referer and also as mentioned by @Luke there may be an issue with the default.

If you can get a tcpdump of both - I will compare the two. See my note above here

Posted

Hi, I have the same problem, and several friends with emby also have it. Can you go back to version 1.0.34 while you fix the problem? Thanks

  • Agree 1
Posted
56 minutes ago, sa2000 said:

From other posts, I presume your server is running on a Synology NAS. Are you able to setup tcpdump on your NAS ? I would like to see the difference in the http request that is now sent by Emby Server in comparison to what the other applications that work are sending - so capturing the network packet that is getting 403 with Emby and working ok with the others. 

In version 1.0.35 we changed the Referrer to Referer and also as mentioned by @Luke there may be an issue with the default.

If you can get a tcpdump of both - I will compare the two. See my note above here

Emby has been running on an Intel NUC Windows 10 for 6 years, no problems! But this is a serious problem for me!

There are many people who have the same problem going back to the previous version, this has made me delete my entire m3u list and lose config, logos, epg, everything! Due to an error when updating the plugins, I ask that in future updates it is verified that everything works well!

The problem is in Emby.

  • Like 1
Posted

I have already tried several applications and the error is only in emby and it is after the update.

They should go back to what worked before.

Right now I will stop using emby until it is fixed and it is a shame I have been using it for 6 years and I have a lifetime license.

Posted

Because of this error, my friends in my emby are missing sporting events. This is outrageous and should be resolved as soon as possible.

Posted (edited)

error right now the forbidden error no longer appears now that error appears ...

 

Screenshot_2025-01-18-17-41-59-565-edit_com.miui.gallery.jpg

Edited by alex553
Posted

@alex553 @dius@vdatanet M3U TV Tuner 1.0.36 has just been released. If you have got it, please restart the server to pick it up. if not, then restart the server to get it checked for and after it is downloaded as seen in the dashboard, please restart the server againn to complete the installation

 

@sk222FYI

Posted (edited)
17 minutes ago, sa2000 said:

@alex553 @dius@vdatanet M3U TV Tuner 1.0.36 has just been released. If you have got it, please restart the server to pick it up. if not, then restart the server to get it checked for and after it is downloaded as seen in the dashboard, please restart the server againn to complete the installation

 

@sk222FYI

New versión error FORBBIDEN!

Screenshot_2025-01-18-18-47-01-962-edit_com.mb.android.jpg

Screenshot_2025-01-18-18-49-18-429-edit_com.mb.android.jpg

Edited by alex553
  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...