yt-react-db / issue-tracker

yt-react-db issue tracker
https://yt-react-db.com
0 stars 0 forks source link

Extension doesn't work on google chrome #20

Open ComputerBread opened 1 year ago

ComputerBread commented 1 year ago

Issue

On Linux Ubuntu 22.04 with Google Chrome Version 117.0.5938.62 (64 bits) if you install the extension through chrome web store then go to a video, it's not finding the element containing the channel ID:

[yt-react-db] Attempt #79 failed:
          element missing: true,
          publication date missing: false,
          video player missing: false,
          trying again

Unfortunately document.querySelector("#infocard-channel-button a") returns null.

Solution?

You can still find the channel ID in an other element: div#iv-drawer > div.iv-drawer-content > div.iv-card-channel > a.iv-click-target

document.querySelectorAll("a.iv-click-target") returns 2 elements. document.querySelectorAll("div.iv-card-channel a") returns only 1 element.

document.querySelector("div.iv-card-channel a").href returns 'https://www.youtube.com/channel/UCIv6GIlP5uXbiu666bOUobQ'

Well nevermind, it works for this video but not for video (it returns null). Wait, :fearful: I can't find the channelID for this video :fearful: oh no

On another video, you have 3 different ways to get it:

:fearful: did I just wasted 2 months for nothing? if it doesn't work on chrome, is it GG? I don't want to spend mroe time on this shit

I guess I will have to change my plans and use the custom URL that I didn't want to use! aïe aïe aïe

the work to do

 backend

{
  "kind": "..",
  "etag": "...",
  "pageInfo": {
    "totalResults": 1,
    "resultsPerPage": 5
  },
  "items": [
    {
      ...
      "id": "...channelID",
      "snippet": {
        "title": "ComputerBread",
        "customUrl": "@computerbread",
        ...
      }
    }
  ]
}

I just care about items[0]["snippet"]["title"], items[0]["snippet"]["customUrl"] and items[0]["id"]

frontend

deploy back & front

extension

If I wanted to make my life easier, I would drop all of this, and just look at the url, if it's a video, I send the video url to the backend, then make a call to YouTube API to get the channel ID, and then fetch permissions and send them back!

why don't I do this? To minimize the load on the server & limit Google API calls

ComputerBread commented 1 year ago

it's hilarious, because on windows, it works fine!

ComputerBread commented 1 year ago

was this just a bug on chrome 117? It works fine on 118