mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-26 06:08:56 +01:00
switch to undici :3
This commit is contained in:
parent
24dfe4032e
commit
2e822fbc68
1 changed files with 4 additions and 4 deletions
|
@ -125,6 +125,7 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/channel/", async (req, res) => {
|
app.get("/channel/", async (req, res) => {
|
||||||
|
const { fetch } = await import("undici");
|
||||||
try {
|
try {
|
||||||
const ID = req.query.id;
|
const ID = req.query.id;
|
||||||
const tab = req.query.tab;
|
const tab = req.query.tab;
|
||||||
|
@ -132,7 +133,7 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// about
|
// about
|
||||||
const bout = await modules.fetch(
|
const bout = await fetch(
|
||||||
config.tubeApi + `channel?id=${ID}&tab=about`
|
config.tubeApi + `channel?id=${ID}&tab=about`
|
||||||
);
|
);
|
||||||
const h = await bout.text();
|
const h = await bout.text();
|
||||||
|
@ -154,8 +155,7 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
|
|
||||||
const getChannelData = async (url) => {
|
const getChannelData = async (url) => {
|
||||||
try {
|
try {
|
||||||
return await modules
|
return await fetch(url)
|
||||||
.fetch(url)
|
|
||||||
.then((res) => res.text())
|
.then((res) => res.text())
|
||||||
.then((txt) => getJson(txt));
|
.then((txt) => getJson(txt));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -176,7 +176,7 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
`https://invid-api.poketube.fun/api/v1/channels/${ID}/`
|
`https://invid-api.poketube.fun/api/v1/channels/${ID}/`
|
||||||
);
|
);
|
||||||
var cPromise = getChannelData(
|
var cPromise = getChannelData(
|
||||||
`https://invid-api.poketube.fun/api/v1/channels/community/${ID}/`
|
`https://invid-api.poketube.fun/api/v1/channels/community/${ID}/?hl=en-US`
|
||||||
);
|
);
|
||||||
var tj = await tjPromise;
|
var tj = await tjPromise;
|
||||||
var shorts = await shortsPromise;
|
var shorts = await shortsPromise;
|
||||||
|
|
Loading…
Reference in a new issue