Comments (7)
Same problem I'm about to ask this as well
Is there any way to add headers?
from m3u8.
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.
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.
see here: https://github.com/llychao/m3u8-downloader
from m3u8.
the ?token after the .m3u8 probably confuses the m3u8 reader
from m3u8.
the ?token after the .m3u8 probably confuses the m3u8 reader
Bro. That was 2020 =D
from m3u8.
👍
from m3u8.
Related Issues (12)
- 功能建议: 下载进度 HOT 1
- directory not found HOT 2
- x509: certificate signed by unknown authority
- 不支持加密ts文件 HOT 1
- Add the update for Windows versions too
- File name parameter
- Stuttering final TS file [bug] HOT 3
- Download multiple link HOT 1
- cannot find package HOT 2
- parse url with '..' error
- Add custom headers HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from m3u8.