Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue] Ads showing on Youtube #28

Closed
agentsix1 opened this issue Aug 3, 2024 · 6 comments · Fixed by #29
Closed

[Issue] Ads showing on Youtube #28

agentsix1 opened this issue Aug 3, 2024 · 6 comments · Fixed by #29
Labels
bug Something isn't working
Milestone

Comments

@agentsix1
Copy link

With the new fix comes new problems. It shows ads which throws off everyone's timing. And if the ads are super long you cant click skip...

Not 100% certain how to fix that but I hope you can find a way!

@CattoGamer
Copy link
Member

I won't be able to do anything about it, YouTube is actively working on it so that you can't bypass the ads. The only hope I can give is to rewrite the complete YouTube service and switch to Invidious.

@agentsix1
Copy link
Author

Interesting. Just being a tiny bit intersted. I did some looking at it. Seems like a cool idea

I was messing with chatgpt to see what it knew about it. It turns out it knows something. I haven't tested any of this code. But if you wanted to mess with it and see what you can manage. Maybe I can put in a few hours tomorrow if you haven't found a fix for it atm.

But this was the script it outputted for me

`
if SERVER then
util.AddNetworkString("FetchVideoTitle")

-- Function to fetch video title using Invidious API
function FetchVideoTitle(videoID)
    local url = "https://invidious.snopyta.org/api/v1/videos/" .. videoID
    
    -- Send HTTP request to Invidious API
    http.Fetch(url,
        function(body, len, headers, code)
            if code == 200 then
                local data = util.JSONToTable(body)
                if data and data.title then
                    print("Video Title: " .. data.title)
                    
                    -- Sending video title to the client
                    net.Start("FetchVideoTitle")
                    net.WriteString(data.title)
                    net.Broadcast()
                else
                    print("Error: Unable to fetch video title")
                end
            else
                print("Error: HTTP request failed with code " .. code)
            end
        end,
        function(error)
            print("Error: HTTP request failed - " .. error)
        end
    )
end

-- Example usage
hook.Add("PlayerSay", "FetchVideoTitleCommand", function(ply, text)
    if string.StartWith(text, "!fetchvideo ") then
        local videoID = string.sub(text, 13)
        FetchVideoTitle(videoID)
        return ""
    end
end)

end

if CLIENT then
net.Receive("FetchVideoTitle", function()
local title = net.ReadString()
chat.AddText(Color(0, 255, 0), "Video Title: ", Color(255, 255, 255), title)
end)
end
`

Seems like a fun interesting puzzle to mess with and see what can be learned

@CattoGamer
Copy link
Member

I'm sorry, but ChatGPT won't really explain to you how to implement anything in such situations. Invidious that many instances that should be as close as possible to the next user.

@CattoGamer CattoGamer added this to the In Progress milestone Aug 4, 2024
@CattoGamer CattoGamer added the bug Something isn't working label Aug 4, 2024
@CattoGamer CattoGamer pinned this issue Aug 4, 2024
@CattoGamer CattoGamer linked a pull request Aug 4, 2024 that will close this issue
@CattoGamer
Copy link
Member

The YouTube service has been rewritten and now runs on other sites, unfortunately this will cause inconvenience for users. Unfortunately there is nothing more I can do.

@JamTester
Copy link

Is there any reason why Invidious cannot be used?

@agentsix1
Copy link
Author

Is there any reason why Invidious cannot be used?

At this time it is being used. It's just not the best method to do it. It does fix the issues I was having. However, sometimes finding an invidious instance that works properly. It's actually kinda annoying but this works and is a better solution than not having it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants