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
I just care about items[0]["snippet"]["title"], items[0]["snippet"]["customUrl"] and items[0]["id"]
[x] modify models/claim.rs struct to add the custom
[x] modify database to store custom url (btw, customUrl is NOT case sensitive)
[x] modify /set_permissions to store customURL
[x] create new endpoint to fetch permissions by customURL (or modify existing one?)
[x] can channelID contain an @?
[x] same endpoint and check if it starts with @?
Yes, using a single endpoint makes more sense. Why? Because I am now going to track the ytd-channel-name element which can contain https://www.youtube.com/channel/<channel_ID> or https://www.youtube.com/@<handle>
frontend
[x] modify AuthorizationCode
[x] (setChannelInfo) (line 66)
[x] add custom (line 150)
[x] modify faq.tsx to tell that we also store customURL
[x] modify privacy policy (update date too)
deploy back & front
[x] compile backend locally
[x] scp that shit
[x] turn it off
[x] push frontend
[x] run migration
[x] restart
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
[ ] find html element containing custom url (or channel url)
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:
Unfortunately
document.querySelector("#infocard-channel-button a")
returnsnull
.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 noOn 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
youtube_channel_info_url
inside config.yaml, replacebrandingSettings
bysnippet
google_routes.rs
to match the new response, something like:I just care about
items[0]["snippet"]["title"]
,items[0]["snippet"]["customUrl"]
anditems[0]["id"]
@
?@
? Yes, using a single endpoint makes more sense. Why? Because I am now going to track theytd-channel-name
element which can containhttps://www.youtube.com/channel/<channel_ID>
orhttps://www.youtube.com/@<handle>
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