m3u8 icon indicating copy to clipboard operation
m3u8 copied to clipboard

Parse url failed: request m3u8 URL failed: http error: status code 403

Open Sei969 opened this issue 5 years ago • 7 comments

Hello, I'm trying to download a SiriusXM stream and got the following error:

.\m3u8-windows-10-x64 -u="https://siriusxm-priprodlive.akamaized.net/AAC_Data/metropolitanopera/metropolitanopera_variant_large_v3.m3u8?token=1587734244_df40af36598eb6b72bd08d0470d1f78d&consumer=k2&gupId=3BDA15C5F23ADEEFE7B02D01A66968D4" -o="C:\downloads" Panic: parse url failed: request m3u8 URL failed: http error: status code 403

Is it related to the wrong master.m3u8 parsed?

To try it by yourself please go here with USA Vpn: https://player.siriusxm.com/home/foryou > start free preview > all channels > and choose channel 75 (Met Opera Radio).

Thanks for looking into this!

Sei969 avatar Apr 24 '20 13:04 Sei969

Same problem I'm about to ask this as well

Is there any way to add headers?

zackmark29 avatar Apr 25 '20 17:04 zackmark29

hi, I'm not too familiar with the code just yet and am barely about to use it myself this week.

Error 403 means you didn't have any access to the resource you requested, you probably need authorization headers like zackmark29 hinted.

If you know how to generate the authorization header value, or know where to scrape it, it shouldn't be too hard for me modify this code so you can pass it through

BRUHItsABunny avatar May 07 '20 04:05 BRUHItsABunny

I've been able to download protected video by setting two headers: Cookie and User-Agent. First, find the right values for that by using the developer tools of your browser. Then I could integrate them by changing the Func Get in the http.go file:

func Get(url string) (io.ReadCloser, error) {
    req, err := http.NewRequest("GET", url, nil)
    if err != nil {
    }
    req.Header.Set("Cookie", "...your cookie that makes it work")
    req.Header.Set("User-Agent", "...your user agent...")

	c := http.Client{
		Timeout: time.Duration(60) * time.Second,
	}
	resp, err := c.Do(req)
	if err != nil {
		return nil, err
	}
	if resp.StatusCode != 200 {
		return nil, fmt.Errorf("http error: status code %d", resp.StatusCode)
	}
	return resp.Body, nil
}

You might need other headers depending on how the website you're downloading from works

titibandit avatar May 24 '20 18:05 titibandit

see here: https://github.com/llychao/m3u8-downloader

llychao avatar Nov 20 '20 04:11 llychao

the ?token after the .m3u8 probably confuses the m3u8 reader

dave9123 avatar Feb 02 '22 01:02 dave9123

the ?token after the .m3u8 probably confuses the m3u8 reader

Bro. That was 2020 =D

zackmark29 avatar Feb 02 '22 04:02 zackmark29

👍

dave9123 avatar Feb 02 '22 06:02 dave9123