Giter VIP home page Giter VIP logo

Comments (7)

zackmark29 avatar zackmark29 commented on May 29, 2024

Same problem I'm about to ask this as well

Is there any way to add headers?

from m3u8.

BRUHItsABunny avatar BRUHItsABunny commented on May 29, 2024

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

from m3u8.

titibandit avatar titibandit commented on May 29, 2024

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

from m3u8.

llychao avatar llychao commented on May 29, 2024

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

from m3u8.

dave9123 avatar dave9123 commented on May 29, 2024

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

from m3u8.

zackmark29 avatar zackmark29 commented on May 29, 2024

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

Bro. That was 2020 =D

from m3u8.

dave9123 avatar dave9123 commented on May 29, 2024

👍

from m3u8.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.