Skip to content

Commit

Permalink
feat(Parser): Add HowThisWasMadeSectionView node
Browse files Browse the repository at this point in the history
  • Loading branch information
LuanRT committed Dec 14, 2024
1 parent c0043d0 commit 5da8a66
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
18 changes: 18 additions & 0 deletions src/parser/classes/HowThisWasMadeSectionView.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { type RawNode } from '../index.js';
import { YTNode } from '../helpers.js';
import Text from "./misc/Text.js";

Check failure on line 3 in src/parser/classes/HowThisWasMadeSectionView.ts

View workflow job for this annotation

GitHub Actions / lint

Strings must use singlequote

export default class HowThisWasMadeSectionView extends YTNode {
static type = 'HowThisWasMadeSectionView';

public section_title: Text;
public body_text: Text;
public body_header: Text;

constructor(data: RawNode) {
super();
this.section_title = Text.fromAttributed(data.sectionText);
this.body_text = Text.fromAttributed(data.bodyText);
this.body_header = Text.fromAttributed(data.bodyHeader);
}
}
15 changes: 9 additions & 6 deletions src/parser/classes/StructuredDescriptionContent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { YTNode, type ObservedArray } from '../helpers.js';
import { type ObservedArray, YTNode } from '../helpers.js';
import { Parser, type RawNode } from '../index.js';
import ExpandableVideoDescriptionBody from './ExpandableVideoDescriptionBody.js';
import HorizontalCardList from './HorizontalCardList.js';
Expand All @@ -7,24 +7,27 @@ import VideoDescriptionInfocardsSection from './VideoDescriptionInfocardsSection
import VideoDescriptionMusicSection from './VideoDescriptionMusicSection.js';
import VideoDescriptionTranscriptSection from './VideoDescriptionTranscriptSection.js';
import VideoDescriptionCourseSection from './VideoDescriptionCourseSection.js';
import ReelShelf from './ReelShelf.js';
import VideoAttributesSectionView from './VideoAttributesSectionView.js';
import HowThisWasMadeSectionView from "./HowThisWasMadeSectionView.js";

Check failure on line 11 in src/parser/classes/StructuredDescriptionContent.ts

View workflow job for this annotation

GitHub Actions / lint

Strings must use singlequote
import ReelShelf from './ReelShelf.js';

export default class StructuredDescriptionContent extends YTNode {
static type = 'StructuredDescriptionContent';

items: ObservedArray<
public items: ObservedArray<
VideoDescriptionHeader | ExpandableVideoDescriptionBody | VideoDescriptionMusicSection |
VideoDescriptionInfocardsSection | VideoDescriptionTranscriptSection | VideoDescriptionTranscriptSection |
VideoDescriptionCourseSection | HorizontalCardList | ReelShelf | VideoAttributesSectionView
VideoDescriptionInfocardsSection | VideoDescriptionTranscriptSection |
VideoDescriptionCourseSection | HorizontalCardList | ReelShelf | VideoAttributesSectionView |
HowThisWasMadeSectionView
>;

constructor(data: RawNode) {
super();
this.items = Parser.parseArray(data.items, [
VideoDescriptionHeader, ExpandableVideoDescriptionBody, VideoDescriptionMusicSection,
VideoDescriptionInfocardsSection, VideoDescriptionCourseSection, VideoDescriptionTranscriptSection,
VideoDescriptionTranscriptSection, HorizontalCardList, ReelShelf, VideoAttributesSectionView
VideoDescriptionTranscriptSection, HorizontalCardList, ReelShelf, VideoAttributesSectionView,
HowThisWasMadeSectionView
]);
}
}
1 change: 1 addition & 0 deletions src/parser/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ export { default as HistorySuggestion } from './classes/HistorySuggestion.js';
export { default as HorizontalCardList } from './classes/HorizontalCardList.js';
export { default as HorizontalList } from './classes/HorizontalList.js';
export { default as HorizontalMovieList } from './classes/HorizontalMovieList.js';
export { default as HowThisWasMadeSectionView } from './classes/HowThisWasMadeSectionView.js';
export { default as IconLink } from './classes/IconLink.js';
export { default as ImageBannerView } from './classes/ImageBannerView.js';
export { default as IncludingResultsFor } from './classes/IncludingResultsFor.js';
Expand Down

0 comments on commit 5da8a66

Please sign in to comment.