Skip to content

Commit f4fdf2e

Browse files
committed
welcome back pg
1 parent 59bd0a7 commit f4fdf2e

File tree

7 files changed

+114
-54
lines changed

7 files changed

+114
-54
lines changed

.env.example

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,3 @@ CONFIG_DISCORD_LOGS_CHANNEL='YOUR_DISCORD_LOGS_CHANNEL'
2020

2121
# Backups
2222
BACKUP_ENABLED=true
23-
BACKUP_USING_SSH=false # It will still backup locally if set to true
24-
25-
# Note: The following sections are only required if BACKUP_USING_SSH is set to true
26-
BACKUP_SSH_HOST='YOUR_SSH_HOST'
27-
BACKUP_SSH_PORT='22' # Default SSH port is 22
28-
BACKUP_SSH_USER='YOUR_SSH_USER'
29-
BACKUP_SSH_PASSWORD='YOUR_SSH_PASSWORD' # You must use a password as private keys are not supported yet
30-
BACKUP_SSH_PATH='YOUR_SSH_PATH' # The path where the backups will be stored

.gitattributes

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
* text=auto eol=lf
2-
*.lockb binary diff=lockb

bun.lock

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
"dependencies": {
77
"cron": "^3.2.1",
88
"discord.js": "^14.16.3",
9+
"pg": "^8.15.6",
910
},
1011
"devDependencies": {
1112
"@types/bun": "1.1.14",
13+
"@types/pg": "^8.11.14",
1214
"@typescript-eslint/eslint-plugin": "8.11.0",
1315
"@typescript-eslint/parser": "8.11.0",
1416
"eslint": "^8.57.0",
@@ -74,6 +76,8 @@
7476

7577
"@types/node": ["@types/node@20.12.14", "", { "dependencies": { "undici-types": "~5.26.4" } }, "sha512-scnD59RpYD91xngrQQLGkE+6UrHUPzeKZWhhjBSa3HSkwjbQc38+q3RoIVEwxQGRw3M+j5hpNAM+lgV3cVormg=="],
7678

79+
"@types/pg": ["@types/pg@8.11.14", "", { "dependencies": { "@types/node": "*", "pg-protocol": "*", "pg-types": "^4.0.1" } }, "sha512-qyD11E5R3u0eJmd1lB0WnWKXJGA7s015nyARWljfz5DcX83TKAIlY+QrmvzQTsbIe+hkiFtkyL2gHC6qwF6Fbg=="],
80+
7781
"@types/ws": ["@types/ws@8.5.14", "", { "dependencies": { "@types/node": "*" } }, "sha512-bd/YFLW+URhBzMXurx7lWByOu+xzU9+kb3RboOteXYDfW+tr+JZa99OyNmPINEGB/ahzKrEuc8rcv4gnpJmxTw=="],
7882

7983
"@typescript-eslint/eslint-plugin": ["@typescript-eslint/eslint-plugin@8.11.0", "", { "dependencies": { "@eslint-community/regexpp": "^4.10.0", "@typescript-eslint/scope-manager": "8.11.0", "@typescript-eslint/type-utils": "8.11.0", "@typescript-eslint/utils": "8.11.0", "@typescript-eslint/visitor-keys": "8.11.0", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", "ts-api-utils": "^1.3.0" }, "peerDependencies": { "@typescript-eslint/parser": "^8.0.0 || ^8.0.0-alpha.0", "eslint": "^8.57.0 || ^9.0.0" } }, "sha512-KhGn2LjW1PJT2A/GfDpiyOfS4a8xHQv2myUagTM5+zsormOmBlYsnQ6pobJ8XxJmh6hnHwa2Mbe3fPrDJoDhbA=="],
@@ -406,6 +410,8 @@
406410

407411
"object.values": ["object.values@1.2.1", "", { "dependencies": { "call-bind": "^1.0.8", "call-bound": "^1.0.3", "define-properties": "^1.2.1", "es-object-atoms": "^1.0.0" } }, "sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA=="],
408412

413+
"obuf": ["obuf@1.1.2", "", {}, "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg=="],
414+
409415
"once": ["once@1.4.0", "", { "dependencies": { "wrappy": "1" } }, "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w=="],
410416

411417
"optionator": ["optionator@0.9.4", "", { "dependencies": { "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", "levn": "^0.4.1", "prelude-ls": "^1.2.1", "type-check": "^0.4.0", "word-wrap": "^1.2.5" } }, "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g=="],
@@ -426,10 +432,38 @@
426432

427433
"path-parse": ["path-parse@1.0.7", "", {}, "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw=="],
428434

435+
"pg": ["pg@8.15.6", "", { "dependencies": { "pg-connection-string": "^2.8.5", "pg-pool": "^3.9.6", "pg-protocol": "^1.9.5", "pg-types": "^2.1.0", "pgpass": "1.x" }, "optionalDependencies": { "pg-cloudflare": "^1.2.5" }, "peerDependencies": { "pg-native": ">=3.0.1" }, "optionalPeers": ["pg-native"] }, "sha512-yvao7YI3GdmmrslNVsZgx9PfntfWrnXwtR+K/DjI0I/sTKif4Z623um+sjVZ1hk5670B+ODjvHDAckKdjmPTsg=="],
436+
437+
"pg-cloudflare": ["pg-cloudflare@1.2.5", "", {}, "sha512-OOX22Vt0vOSRrdoUPKJ8Wi2OpE/o/h9T8X1s4qSkCedbNah9ei2W2765be8iMVxQUsvgT7zIAT2eIa9fs5+vtg=="],
438+
439+
"pg-connection-string": ["pg-connection-string@2.8.5", "", {}, "sha512-Ni8FuZ8yAF+sWZzojvtLE2b03cqjO5jNULcHFfM9ZZ0/JXrgom5pBREbtnAw7oxsxJqHw9Nz/XWORUEL3/IFow=="],
440+
441+
"pg-int8": ["pg-int8@1.0.1", "", {}, "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw=="],
442+
443+
"pg-numeric": ["pg-numeric@1.0.2", "", {}, "sha512-BM/Thnrw5jm2kKLE5uJkXqqExRUY/toLHda65XgFTBTFYZyopbKjBe29Ii3RbkvlsMoFwD+tHeGaCjjv0gHlyw=="],
444+
445+
"pg-pool": ["pg-pool@3.9.6", "", { "peerDependencies": { "pg": ">=8.0" } }, "sha512-rFen0G7adh1YmgvrmE5IPIqbb+IgEzENUm+tzm6MLLDSlPRoZVhzU1WdML9PV2W5GOdRA9qBKURlbt1OsXOsPw=="],
446+
447+
"pg-protocol": ["pg-protocol@1.9.5", "", {}, "sha512-DYTWtWpfd5FOro3UnAfwvhD8jh59r2ig8bPtc9H8Ds7MscE/9NYruUQWFAOuraRl29jwcT2kyMFQ3MxeaVjUhg=="],
448+
449+
"pg-types": ["pg-types@4.0.2", "", { "dependencies": { "pg-int8": "1.0.1", "pg-numeric": "1.0.2", "postgres-array": "~3.0.1", "postgres-bytea": "~3.0.0", "postgres-date": "~2.1.0", "postgres-interval": "^3.0.0", "postgres-range": "^1.1.1" } }, "sha512-cRL3JpS3lKMGsKaWndugWQoLOCoP+Cic8oseVcbr0qhPzYD5DWXK+RZ9LY9wxRf7RQia4SCwQlXk0q6FCPrVng=="],
450+
451+
"pgpass": ["pgpass@1.0.5", "", { "dependencies": { "split2": "^4.1.0" } }, "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug=="],
452+
429453
"picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="],
430454

431455
"possible-typed-array-names": ["possible-typed-array-names@1.0.0", "", {}, "sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q=="],
432456

457+
"postgres-array": ["postgres-array@3.0.4", "", {}, "sha512-nAUSGfSDGOaOAEGwqsRY27GPOea7CNipJPOA7lPbdEpx5Kg3qzdP0AaWC5MlhTWV9s4hFX39nomVZ+C4tnGOJQ=="],
458+
459+
"postgres-bytea": ["postgres-bytea@3.0.0", "", { "dependencies": { "obuf": "~1.1.2" } }, "sha512-CNd4jim9RFPkObHSjVHlVrxoVQXz7quwNFpz7RY1okNNme49+sVyiTvTRobiLV548Hx/hb1BG+iE7h9493WzFw=="],
460+
461+
"postgres-date": ["postgres-date@2.1.0", "", {}, "sha512-K7Juri8gtgXVcDfZttFKVmhglp7epKb1K4pgrkLxehjqkrgPhfG6OO8LHLkfaqkbpjNRnra018XwAr1yQFWGcA=="],
462+
463+
"postgres-interval": ["postgres-interval@3.0.0", "", {}, "sha512-BSNDnbyZCXSxgA+1f5UU2GmwhoI0aU5yMxRGO8CdFEcY2BQF9xm/7MqKnYoM1nJDk8nONNWDk9WeSmePFhQdlw=="],
464+
465+
"postgres-range": ["postgres-range@1.1.4", "", {}, "sha512-i/hbxIE9803Alj/6ytL7UHQxRvZkI9O4Sy+J3HGc4F4oo/2eQAjTSNJ0bfxyse3bH0nuVesCk+3IRLaMtG3H6w=="],
466+
433467
"prelude-ls": ["prelude-ls@1.2.1", "", {}, "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g=="],
434468

435469
"prettier": ["prettier@3.4.2", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ=="],
@@ -482,6 +516,8 @@
482516

483517
"side-channel-weakmap": ["side-channel-weakmap@1.0.2", "", { "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.5", "object-inspect": "^1.13.3", "side-channel-map": "^1.0.1" } }, "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A=="],
484518

519+
"split2": ["split2@4.2.0", "", {}, "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg=="],
520+
485521
"string.prototype.trim": ["string.prototype.trim@1.2.10", "", { "dependencies": { "call-bind": "^1.0.8", "call-bound": "^1.0.2", "define-data-property": "^1.1.4", "define-properties": "^1.2.1", "es-abstract": "^1.23.5", "es-object-atoms": "^1.0.0", "has-property-descriptors": "^1.0.2" } }, "sha512-Rs66F0P/1kedk5lyYyH9uBzuiI/kNRmwJAR9quK6VOtIpZ2G+hMZd+HQbbv25MgCA6gEffoMZYxlTod4WcdrKA=="],
486522

487523
"string.prototype.trimend": ["string.prototype.trimend@1.0.9", "", { "dependencies": { "call-bind": "^1.0.8", "call-bound": "^1.0.2", "define-properties": "^1.2.1", "es-object-atoms": "^1.0.0" } }, "sha512-G7Ok5C6E/j4SGfyLCloXTrngQIQU3PWtXGst3yM7Bea9FRURf1S42ZHlZZtsNque2FN2PoUhfZXYLNWwEr4dLQ=="],
@@ -550,6 +586,8 @@
550586

551587
"ws": ["ws@8.18.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw=="],
552588

589+
"xtend": ["xtend@4.0.2", "", {}, "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="],
590+
553591
"yocto-queue": ["yocto-queue@0.1.0", "", {}, "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q=="],
554592

555593
"@discordjs/rest/@discordjs/collection": ["@discordjs/collection@2.1.1", "", {}, "sha512-LiSusze9Tc7qF03sLCujF5iZp7K+vRNEDBZ86FT9aQAv3vxMLihUvKvpsCWiQ2DJq1tVckopKm1rxomgNUc9hg=="],
@@ -572,6 +610,16 @@
572610

573611
"fast-glob/glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="],
574612

613+
"pg/pg-types": ["pg-types@2.2.0", "", { "dependencies": { "pg-int8": "1.0.1", "postgres-array": "~2.0.0", "postgres-bytea": "~1.0.0", "postgres-date": "~1.0.4", "postgres-interval": "^1.1.0" } }, "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA=="],
614+
575615
"@typescript-eslint/typescript-estree/minimatch/brace-expansion": ["brace-expansion@2.0.1", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA=="],
616+
617+
"pg/pg-types/postgres-array": ["postgres-array@2.0.0", "", {}, "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA=="],
618+
619+
"pg/pg-types/postgres-bytea": ["postgres-bytea@1.0.0", "", {}, "sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w=="],
620+
621+
"pg/pg-types/postgres-date": ["postgres-date@1.0.7", "", {}, "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q=="],
622+
623+
"pg/pg-types/postgres-interval": ["postgres-interval@1.2.0", "", { "dependencies": { "xtend": "^4.0.0" } }, "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ=="],
576624
}
577625
}

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"version": "1.3.0",
66
"devDependencies": {
77
"@types/bun": "1.1.14",
8+
"@types/pg": "^8.11.14",
89
"@typescript-eslint/eslint-plugin": "8.11.0",
910
"@typescript-eslint/parser": "8.11.0",
1011
"eslint": "^8.57.0",
@@ -25,6 +26,7 @@
2526
},
2627
"dependencies": {
2728
"cron": "^3.2.1",
28-
"discord.js": "^14.16.3"
29+
"discord.js": "^14.16.3",
30+
"pg": "^8.15.6"
2931
}
3032
}

src/commands.ts

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import Bun from "bun";
22
import { heapStats } from "bun:jsc";
33
import {
4-
ApplicationIntegrationType,
4+
ApplicationCommandType,
5+
AutocompleteInteraction,
56
ChannelType,
7+
ChatInputCommandInteraction,
68
GuildMember,
7-
InteractionContextType,
89
MessageFlags,
10+
type ApplicationCommandOptionData,
11+
type CacheType,
912
type CommandInteraction,
1013
} from "discord.js";
1114
import { PermissionFlagsBits } from "discord-api-types/v8";
@@ -32,13 +35,17 @@ import client from ".";
3235

3336
interface Command {
3437
data: {
35-
options: any[];
3638
name: string;
3739
description: string;
38-
integration_types: ApplicationIntegrationType[];
39-
contexts: InteractionContextType[];
40+
options?: ApplicationCommandOptionData[];
41+
integration_types?: number[];
42+
contexts?: number[];
43+
type?: ApplicationCommandType;
4044
};
41-
execute: (interaction: CommandInteraction) => Promise<void>;
45+
execute: (interaction: ChatInputCommandInteraction) => Promise<void>;
46+
autoComplete?: (
47+
interaction: AutocompleteInteraction<CacheType>,
48+
) => Promise<any>;
4249
}
4350

4451
const commands: Record<string, Command> = {
@@ -175,11 +182,12 @@ const commands: Record<string, Command> = {
175182
"Enter the YouTube channel ID or Twitch Streamer to track",
176183
type: 3,
177184
required: true,
185+
autocomplete: true,
178186
},
179187
{
180188
name: "updates_channel",
181189
description:
182-
"Enter the Guild channel to recieve updates in.",
190+
"Enter the Guild channel to receive updates in.",
183191
type: 7,
184192
required: false,
185193
},
@@ -207,6 +215,9 @@ const commands: Record<string, Command> = {
207215
interaction.channelId;
208216
const guildId = interaction.guildId;
209217

218+
// Log the autocomplete value
219+
console.log(`Autocomplete value: ${platformUserId}`);
220+
210221
// Checks if the platform is valid ig
211222
if (targetPlatform != "youtube" && targetPlatform != "twitch") {
212223
await interaction.reply({
@@ -386,7 +397,7 @@ const commands: Record<string, Command> = {
386397
}
387398

388399
return;
389-
case "twitch":
400+
case "twitch": {
390401
// Check if the streamer exists by getting the ID
391402
const streamerId = await getStreamerId(platformUserId);
392403

@@ -461,11 +472,24 @@ const commands: Record<string, Command> = {
461472
}
462473

463474
return;
475+
}
464476
default:
465477
console.error("This should never happen");
466478
break;
467479
}
468480
},
481+
autoComplete: async (interaction: AutocompleteInteraction) => {
482+
try {
483+
const platform = interaction.options.get("platform")?.value;
484+
const query = interaction.options.get("user_id")?.value;
485+
486+
if (!query) {
487+
return;
488+
}
489+
} catch (error) {
490+
console.error(error);
491+
}
492+
},
469493
},
470494
untrack: {
471495
data: {
@@ -582,7 +606,7 @@ const commands: Record<string, Command> = {
582606
}
583607

584608
return;
585-
case "twitch":
609+
case "twitch": {
586610
// get the twitch id for the streamer
587611
const streamerId = await getStreamerId(youtubeChannelId);
588612

@@ -632,6 +656,7 @@ const commands: Record<string, Command> = {
632656
}
633657

634658
return;
659+
}
635660
default:
636661
return;
637662
}

src/types/innertube.d.ts

Lines changed: 24 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// NOTE: Experimental
2-
// You think i was typing this all out manually? lol no :p
3-
41
export type InnertubeSearchRequest = {
52
contents: {
63
twoColumnSearchResultsRenderer: {
@@ -9,35 +6,7 @@ export type InnertubeSearchRequest = {
96
contents: Array<{
107
itemSectionRenderer?: {
118
contents: Array<{
12-
didYouMeanRenderer?: {
13-
didYouMean: {
14-
runs: Array<{
15-
text: string;
16-
}>;
17-
};
18-
correctedQuery: {
19-
runs: Array<{
20-
text: string;
21-
italics: boolean;
22-
}>;
23-
};
24-
correctedQueryEndpoint: {
25-
clickTrackingParams: string;
26-
commandMetadata: {
27-
webCommandMetadata: {
28-
url: string;
29-
webPageType: string;
30-
rootVe: number;
31-
};
32-
};
33-
searchEndpoint: {
34-
query: string;
35-
params: string;
36-
};
37-
};
38-
trackingParams: string;
39-
};
40-
channelRenderer?: {
9+
channelRenderer: {
4110
channelId: string;
4211
title: {
4312
simpleText: string;
@@ -91,18 +60,39 @@ export type InnertubeSearchRequest = {
9160
}>;
9261
};
9362
videoCountText: {
94-
accessibility: {
63+
accessibility?: {
9564
accessibilityData: {
9665
label: string;
9766
};
9867
};
99-
simpleText: string;
68+
simpleText?: string;
69+
runs?: Array<{
70+
text: string;
71+
}>;
10072
};
10173
subscriptionButton: {
10274
subscribed: boolean;
10375
};
76+
ownerBadges?: Array<{
77+
metadataBadgeRenderer: {
78+
icon: {
79+
iconType: string;
80+
};
81+
style: string;
82+
tooltip: string;
83+
trackingParams: string;
84+
accessibilityData: {
85+
label: string;
86+
};
87+
};
88+
}>;
10489
subscriberCountText: {
10590
simpleText: string;
91+
accessibility?: {
92+
accessibilityData: {
93+
label: string;
94+
};
95+
};
10696
};
10797
subscribeButton: {
10898
buttonRenderer: {

src/utils/youtube/search.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ export default async function (query: string) {
2323
method: "POST",
2424
},
2525
);
26-
const data = (await response.json()) as Promise<InnertubeSearchRequest>;
26+
27+
const data = (
28+
await ((await response.json()) as Promise<InnertubeSearchRequest>)
29+
).contents.twoColumnSearchResultsRenderer.primaryContents
30+
.sectionListRenderer.contents;
2731

2832
console.dir(data, { depth: null });
2933
} catch (err) {

0 commit comments

Comments
 (0)