Fedi.CrowdedGames.Group/src/HTTP/JS/YoutubeAPI.js
CatAClock 339cfdedf9 V1.1 (#72)
New Version!

- A backend has been created. It now works on a local server. Just compile it with cargo.
- Facet fixed finally.
- Multiple random warning fixes
- Threads now go longer than the 3 that was created before.
- Replies can now be seen.
- Clicking on a bsky post now doesn't break the thing.
- Tags not working as intended (Mastodon)
- Sometimes posts don't load. This is intentional: Sometimes it's "unknown" and "external" and these aren't supported because AIDS or something.

Reviewed-on: #72
Co-authored-by: CatAClock <CatAClock@proton.me>
Co-committed-by: CatAClock <CatAClock@proton.me>
2025-07-17 04:07:33 +00:00

20 lines
780 B
JavaScript

import * as Variables from "./Variables.js";
// Uses the API to get the channel ID.
// Interesting problem: You have to use either an API key or a Auth2.0.
// I think only developer asses will be using this, so we'll use API keys.
export async function GetChannelID(APIKey, Channel) {
if (Channel == "" || APIKey == "") {
console.error("Forgot a variable.");
return;
}
if (Channel.slice(0, 1) != "@") {
// Apply the correct Handle
Channel = "@" + Channel;
}
// Get the channel ID
var webbiesite = "https://www.googleapis.com/youtube/v3/channels";
var response = await fetch(webbiesite + "?part=id&forHandle=" + Channel + "&key=" + APIKey, {method: "GET"})
.then((response) => response.json());
localStorage.setItem(Variables.YoutubeID, response.items[0].id);
}