mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-23 03:17:47 +01:00
test ignore
This commit is contained in:
parent
40095fe64e
commit
867bb45e42
1 changed files with 40 additions and 27 deletions
|
@ -241,36 +241,49 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const apiUrl = config.invapi + "/channels/";
|
const getChannelData = async (url) => {
|
||||||
const channelUrl = `${apiUrl}${atob(
|
try {
|
||||||
ChannelTabs.videos
|
return await fetch(url)
|
||||||
)}/${ID}/?sort_by=${sort_by}${continuation}`;
|
.then((res) => res.text())
|
||||||
const shortsUrl = `${apiUrl}${ID}/${atob(
|
.then((txt) => getJson(txt));
|
||||||
ChannelTabs.shorts
|
} catch (error) {
|
||||||
)}?sort_by=${sort_by}${continuations}`;
|
return null;
|
||||||
const streamUrl = `${apiUrl}${ID}/${atob(
|
}
|
||||||
ChannelTabs.streams
|
};
|
||||||
)}?sort_by=${sort_by}${continuationl}`;
|
|
||||||
const communityUrl = `${apiUrl}${atob(
|
|
||||||
ChannelTabs.community
|
|
||||||
)}/${ID}/?hl=en-US`;
|
|
||||||
const PlaylistUrl = `${apiUrl}${atob(
|
|
||||||
ChannelTabs.playlist
|
|
||||||
)}/${ID}/?hl=en-US`;
|
|
||||||
|
|
||||||
|
const apiUrl = config.invapi + "/channels/";
|
||||||
const channelINVUrl = `${apiUrl}${ID}/`;
|
const channelINVUrl = `${apiUrl}${ID}/`;
|
||||||
const checkPronoun = async (id) => (await (await fetch('https://raw.githubusercontent.com/ashley0143/poke/main/pronounsdb.json')).json())[id] || `no pronouns set`;
|
const checkPronoun = async (id) => (await (await fetch('https://raw.githubusercontent.com/ashley0143/poke/main/pronounsdb.json')).json())[id] || `no pronouns set`;
|
||||||
const pronoun = await checkPronoun(ID);
|
const pronoun = await checkPronoun(ID);
|
||||||
|
|
||||||
var [tj, shorts, playlist, stream, c, cinv] = await Promise.all([
|
const channelINVData = await getChannelData(channelINVUrl);
|
||||||
getChannelData(channelUrl),
|
const cinv = await getChannelData(channelINVUrl);
|
||||||
getChannelData(shortsUrl),
|
|
||||||
getChannelData(PlaylistUrl),
|
if (!channelINVData) {
|
||||||
getChannelData(streamUrl),
|
throw new Error('Failed to fetch channel INV data');
|
||||||
getChannelData(communityUrl),
|
}
|
||||||
getChannelData(channelINVUrl),
|
|
||||||
|
const ChannelTabs = channelINVData.tabs;
|
||||||
|
|
||||||
|
const channelUrl = ChannelTabs.videos ? `${apiUrl}${atob(ChannelTabs.videos)}/${ID}/?sort_by=${sort_by}${continuation}` : null;
|
||||||
|
const shortsUrl = ChannelTabs.shorts ? `${apiUrl}${ID}/${atob(ChannelTabs.shorts)}?sort_by=${sort_by}${continuations}` : null;
|
||||||
|
const streamUrl = ChannelTabs.streams ? `${apiUrl}${ID}/${atob(ChannelTabs.streams)}?sort_by=${sort_by}${continuationl}` : null;
|
||||||
|
const communityUrl = ChannelTabs.community ? `${apiUrl}${atob(ChannelTabs.community)}/${ID}/?hl=en-US` : null;
|
||||||
|
const PlaylistUrl = ChannelTabs.playlist ? `${apiUrl}${atob(ChannelTabs.playlist)}/${ID}/?hl=en-US` : null;
|
||||||
|
|
||||||
|
const fetchData = async (url) => {
|
||||||
|
return url ? getChannelData(url) : null;
|
||||||
|
};
|
||||||
|
|
||||||
|
var [tj, shorts, playlist, stream, c] = await Promise.all([
|
||||||
|
fetchData(channelUrl),
|
||||||
|
fetchData(shortsUrl),
|
||||||
|
fetchData(PlaylistUrl),
|
||||||
|
fetchData(streamUrl),
|
||||||
|
fetchData(communityUrl)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
function getThumbnailUrl(video) {
|
function getThumbnailUrl(video) {
|
||||||
const maxresDefaultThumbnail = video.videoThumbnails.find(
|
const maxresDefaultThumbnail = video.videoThumbnails.find(
|
||||||
(thumbnail) => thumbnail.quality === "maxresdefault"
|
(thumbnail) => thumbnail.quality === "maxresdefault"
|
||||||
|
|
Loading…
Reference in a new issue