nil pointer: ytimg request is not checked in thumbnail #1
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
func getBestThumbnail(path string) (newpath string) {
formats := [4]string{"maxresdefault.jpg", "sddefault.jpg", "hqdefault.jpg", "mqdefault.jpg"}
for _, format := range formats {
newpath = strings.Replace(path, "maxres.jpg", format, 1)
url := "https://i.ytimg.com" + newpath
resp, _ := h2client.Head(url)
if resp.StatusCode == 200 {
return newpath
}
}
return strings.Replace(path, "maxres.jpg", "mqdefault.jpg", 1)
}
err:
dial tcp4 172.217.19.86:443: connect: network is unreachable
i.ytimg.com
has ipv6 addresses but ipv4 is still used even if unreachableNeed to set
-ipv6_only
flagIs there a reason Dial is overridden vs just the default (which I assume would try both?)
No idea. I can't even test IPV6 because I don't even have IPV6 on any of my servers.
And that code is from https://github.com/TeamPiped/http3-ytproxy/blob/main/main.go#L35-L39
This is a hard fork of that repository, used for my invidious instance. I added a lot of things but I'm clueless about the Dialer since I never had any problems with it.
There is any way to reproduce this? I wonder why would you want to use this proxy too.
I have a server that only has ipv6 (no ipv4).
Invidious can't run from a datacenter IP so I reverse proxy from my server over tailscale. Proxying video and images takes up more bandwidth and tailscale doesn't have great performance. Instead I run invidious from residential but proxy video/images from datacenter.
For the dailer, the supported network (ipv4/ipv6) is passed into the function. Instead of setting it yourself, you can just pass it through unless you want to disable one of them.
You can use Netmaker instead, it's a MeshVPN like Tailscale but it uses Kernel level wireguard so performance should be better in a VPS.
The only downside is that you need to setup your own NetMaker server to use it and that can be tricky to do. You can use my NetMaker server with your own account if you want but you will need to request an account of course. And I'm not sure if the connecting cuts of between the devices if the NetMaker server is down.
I see.
Btw, yesterday I hard coded some values on the code, you can see why in the commit lol. If you want to use it for your instance, make sure to comment comment that
if else
statement before compiling or revert to the previous commit. If you use docker you can just use an old version of the image which is catalogued by date.