From f4bc8508d0cd3efa4e1b3c0cdc9d5d9501eb9262 Mon Sep 17 00:00:00 2001 From: Ryan Sandbach Date: Tue, 12 Sep 2023 02:49:36 -0400 Subject: [PATCH] chore(docs): Minor update (#502) * Updated documentation example to matche syntax of existing parsers. * Changed from require since package is setup as module. --- docs/updating-the-parser.md | 10 ++++------ examples/auth/index.js | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/docs/updating-the-parser.md b/docs/updating-the-parser.md index 2b2211f0..37ad6cf8 100644 --- a/docs/updating-the-parser.md +++ b/docs/updating-the-parser.md @@ -31,24 +31,22 @@ For example, suppose we have found a new renderer named `verticalListRenderer`. > `../classes/VerticalList.ts` ```ts -import Parser from '..'; -import { YTNode } from '../helpers'; -import type { RawNode } from '../index.js'; +import Parser, { RawNode } from '../index.js'; +import { YTNode } from '../helpers.js'; -class VerticalList extends YTNode { +export default class VerticalList extends YTNode { static type = 'VerticalList'; header; contents; constructor(data: RawNode) { + super(); // parse the data here, ex; this.header = Parser.parseItem(data.header); this.contents = Parser.parseArray(data.contents); } } - -export default VerticalList; ``` You may use the parser's generated class for the new renderer as a starting point for your own implementation. diff --git a/examples/auth/index.js b/examples/auth/index.js index a2ddfa07..c326da89 100644 --- a/examples/auth/index.js +++ b/examples/auth/index.js @@ -1,4 +1,4 @@ -const { Innertube, UniversalCache } = require('youtubei.js'); +import { Innertube, UniversalCache } from 'youtubei.js'; (async () => { const yt = await Innertube.create({