FreeTubeApp / FreeTube

An Open Source YouTube app for privacy
https://freetubeapp.io/
GNU Affero General Public License v3.0
13.13k stars 815 forks source link

[Bug]: Both Local and Individuous API don't work. Pulling Null of Video #5534

Open kasselvania opened 1 month ago

kasselvania commented 1 month ago

Guidelines

⚠️ Maintainer edit ⚠️

The cause of the local API error is that you are using a VPN or proxy IP address that is blocked by YouTube. FreeTube needs to display a better error message when that happens but the only way to prevent it happening is to use a different VPN or proxy IP address that isn't blocked.

The Invidious error is caused by Invidious instances getting blocked by YouTube, there is nothing we can do about it on the FreeTube side, you just have to be patient and wait for the Invidious maintainers to find a solution and for the people hosting Invidious instances to implement said solutions.

Describe the bug

Whenever attempting to open a video, I am greeted by messages that say:

"Local API Error: Type Error: Cannot read properties of null (reading 'reason'). Then, Invidious API error: Error: Missing harsh key "videoDetails"

I cannot get any videos to play

Screenshot 2024-08-06 at 1 42 26 PM

Expected Behavior

I would expect to click the video link and have the video play.

Issue Labels

API issue

FreeTube Version

v0.21.3 Beta

Operating System Version

macOS Sonoma 14.6

Installation Method

.dmg

Primary API used

Local API

Last Known Working FreeTube Version (If Any)

v0.21.1 Beta

Additional Information

No response

Nightly Build

Gorrrg commented 1 month ago

I've found your bugfix:

Last Known Working FreeTube Version (If Any) v0.21.1 Beta

Change the last line to v0.21.3 beta. 😅

kasselvania commented 1 month ago

I have actually figured out that my VPN, Private Internet Access, doesn't play well with FreeTube. Can't figure out why.

qwtoe commented 1 month ago

I met the same error

qwtoe commented 1 month ago

I met the same error

i found out a solution, just simply adjust external player in Settings:

image

absidue commented 1 month ago

@kasselvania Can you try opening the devtools with Cmd+Shift+I and look at the console tab? Maybe that has more about details about the error messages. Additionally does this happen with every video or only specific ones?

Ammako commented 1 month ago

I would assume this is just the same problem invidious is having, with videos not available unless signed in. Newpipe is also affected. but not everybody is stuck with this because it will depend on your IP address, among other things (VPN is more likely to be affected, because so many people share an IP address, youtube is a lot more likely to demand a log in for "verification" reasons.)

PS: copy youtube link for the video, open it in a web browser, and find out that it will require you to log in before you can watch the video here as well.

kasselvania commented 1 month ago

@kasselvania Can you try opening the devtools with Cmd+Shift+I and look at the console tab? Maybe that has more about details about the error messages. Additionally does this happen with every video or only specific ones?

Honestly? There is no way to tell what kind of video will work, as apposed to others. If I open the developer tools, I see stuff like this screenshot.

Screenshot 2024-08-15 at 7 40 30 PM

@Ammako I will try logging in and see if that corrects my issue! Thanks for the suggestion!

absidue commented 4 weeks ago

@Ammako Even if that is the case, I think we can all agree that it would be better to figure out what YouTube returns in that case so that FreeTube can show a proper error message instead of breaking like it does now.

absidue commented 4 weeks ago

@kasselvania Interesting, I'm guessing you got a different error messages in the toasts/popups this time (something a long the line of failed to fetch)? So this time it seems like you got a different problem, the last red message says ERR_NAME_NOT_RESOLVED, which means it failed to resolve the DNS name to an IP address or in less technical terms it failed to figure out what IP address (combination of numbers) is associated to www.youtube.com.

Try connecting and disconnecting from your VPN, to solve the problem you got this time. As for the original problem, it seems like that is still somewhat of a mystery.

kasselvania commented 4 weeks ago

@absidue i still get the error in the main window like above not pulling Null from the video, and the video stating it’s from Dec 31, 1960, with no data presented. I usually need to quit Freetube, turn off my VPN, and then reopen freetube WITHOUT my VPN for a few videos for it to work again. Then, once it’s running, for a video or two, I can add the VPN back into the mix again. This problem is pretty frequent, though.

Ammako commented 4 weeks ago

Even if that is the case, I think we can all agree that it would be better to figure out what YouTube returns in that case so that FreeTube can show a proper error message instead of breaking like it does now.

It's weird, because piped, invidious, and newpipe all get the clear "Sign in to confirm you're not a bot" error directly. but I guess Freetube handles youtube differently than those three do.

Victor239 commented 2 weeks ago

Yeah I get this problem consistently when on my VPN also, it falls back to Invidious.

absidue commented 2 weeks ago

If someone could capture what the response from YouTube looks like when that error occurs, that would help a lot in trying to figure out what is going on, as I've not been able to reproduce this on various VPN IP addresses.

Here is how you could do that:

  1. Open the developer tools by pressing Ctrl+Shift+I or Command+Shift+I on macOS
  2. Switch to the Network tab
  3. In the text box that says Filter type /player (you won't see any results yet, that will come later)
  4. Open a video (leave the devtools open otherwise they won't capture any data)
  5. After the error occurs take a look at the list in the Network tab, you should see two entries whose names start with player?
  6. Repeat these steps for each of the requests (there should be two)
    • Right click on the request
    • Go to Copy
    • The click on Copy Response
    • Paste the response into a text file.
  7. Upload the files here or if you don't feel comfortable doing that you can also send them to my email address git (at) absidue.me.
EugeneDubuk commented 1 week ago

@absidue #5534.zip

absidue commented 1 week ago

Okay so as expected the cause of the error is that you are using a VPN IP address that is blocked by YouTube. FreeTube needs to display a better error message when that happens but the only way to prevent it happening is to use a different VPN IP address that isn't blocked.

EugeneDubuk commented 1 week ago

How about adding optional login box in Freetube for such cases?

absidue commented 1 week ago

Firstly that would go against FreeTube's primary goal of being a privacy friendly app and secondly despite the error message suggesting you login, I would really not recommend doing that on a blocked IP even in your web browser unless you want your Google account blocked (people that have tried to use logging in to bypass IP blocks have had their accounts blocked).

Ammako commented 1 week ago

(people that have tried to use logging in to bypass IP blocks have had their accounts blocked)

source on people getting their google account blocked for logging in on web/official youtube app from these kind of vpn ips?

absidue commented 1 week ago

source on people getting their google account blocked for logging in on web/official youtube app from these kind of vpn ips?

I think you may have misinterpreted the message or I wasn't clear enough in my writing.

Ammako commented 1 week ago

source on people getting their google account blocked for logging in on web/official youtube app from these kind of vpn ips?

I think you may have misinterpreted the message or I wasn't clear enough in my writing.

and secondly despite the error message suggesting you login, I would really not recommend doing that on a blocked IP even in your web browser unless you want your Google account blocked

this is what I'm referring to

absidue commented 1 week ago

The resolution to this issue will be for FreeTube to show a better error message that explains that you need to change to a new IP address, something along the lines of: "YouTube has blocked the IP address that you are using so you can no longer watch videos on it, if you are using a VPN try changing to a different server in your VPN settings, if you are not using a VPN or a proxy, you will have to start using one"

Ammako commented 1 week ago

For those who can't find a working VPN and who really would rather not turn off VPN (or if your home IP is also blocked), I think it's worth suggesting invidious as an alternative in the error message, because most instances have a functional workaround implemented by now.

Victor239 commented 1 week ago

There's currently a setting to Proxy Videos Through Invidious, which overrides API preference. It would be helpful if this could be used as a fallback in case Local API is blocked due to VPN use.

absidue commented 1 week ago

@Victor239 FreeTube already falls back to the Invidious API if the local API fails and vice versa, as long as you haven't turned off the Fallback to Non-Preferred Backend on Failure setting in the general settings (it's on by default), the Proxy Videos Through Invidious setting is unrelated.

You can see the fallback in action in the screenshot in the description of the issue, they were just unlucky enough to also be using an Invidious instance that was broken which is why it still didn't work even after falling back to the Invidious API.

EugeneDubuk commented 1 week ago

One more idea. There is an option in ... > Open YouTube Embedded Player. It opens video in my browser and it works perfectly. But what would be much convenient, if I could set a default action setting to open all videos in browser by default, without clicking on .... And the second, video have to be marked as WATCHED after opening it in browser.

Mind777 commented 1 week ago

I am frequently getting this error also.

Victor239 commented 1 week ago

One more idea. There is an option in ... > Open YouTube Embedded Player. It opens video in my browser and it works perfectly. But what would be much convenient, if I could set a default action setting to open all videos in browser by default, without clicking on .... And the second, video have to be marked as WATCHED after opening it in browser.

I like this idea as well for times when FreeTube suddenly stops playing videos due to YouTube changes. Another useful option would be to always open external player as a default action.

andriuhatm commented 3 days ago

Hmm was getting this error with Surfshark VPN enabled as well. Seems to work fine with it off.