Add support for Invidious's storyboard.
This commit is contained in:
parent
3ba265d0ea
commit
eb64ae2cbe
1 changed files with 8 additions and 2 deletions
10
main.go
10
main.go
|
@ -39,7 +39,12 @@ func genericHTTPProxy(w http.ResponseWriter, req *http.Request) {
|
||||||
log.Panic("No host in query parameters.")
|
log.Panic("No host in query parameters.")
|
||||||
}
|
}
|
||||||
|
|
||||||
proxyURL, err := url.Parse("https://" + host + strings.Replace(req.URL.Path, "/ggpht", "", 1))
|
path := req.URL.Path
|
||||||
|
|
||||||
|
path = strings.Replace(path, "/ggpht", "", 1)
|
||||||
|
path = strings.Replace(path, "/i/", "/", 1)
|
||||||
|
|
||||||
|
proxyURL, err := url.Parse("https://" + host + path)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Panic(err)
|
log.Panic(err)
|
||||||
|
@ -93,7 +98,7 @@ func getHost(path string) (host string) {
|
||||||
|
|
||||||
host = ""
|
host = ""
|
||||||
|
|
||||||
if strings.HasPrefix(path, "/vi/") {
|
if strings.HasPrefix(path, "/vi/") || strings.HasPrefix(path, "/sb/") {
|
||||||
host = "i.ytimg.com"
|
host = "i.ytimg.com"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,6 +134,7 @@ func main() {
|
||||||
http.HandleFunc("/vi/", genericHTTPProxy)
|
http.HandleFunc("/vi/", genericHTTPProxy)
|
||||||
http.HandleFunc("/a/", genericHTTPProxy)
|
http.HandleFunc("/a/", genericHTTPProxy)
|
||||||
http.HandleFunc("/ggpht/", genericHTTPProxy)
|
http.HandleFunc("/ggpht/", genericHTTPProxy)
|
||||||
|
http.HandleFunc("/sb/", genericHTTPProxy)
|
||||||
socket := "socket" + string(os.PathSeparator) + "http-proxy.sock"
|
socket := "socket" + string(os.PathSeparator) + "http-proxy.sock"
|
||||||
syscall.Unlink(socket)
|
syscall.Unlink(socket)
|
||||||
listener, err := net.Listen("unix", socket)
|
listener, err := net.Listen("unix", socket)
|
||||||
|
|
Loading…
Add table
Reference in a new issue