-
-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for retrieving transcripts (#500)
* feat: Add support for retrieving transcripts * chore: lint * chore: update docs * chore: Do not include nodes in errors thrown * chore: Improve error messages * fix(ExpandableMetadata): `expanded_content` type mismatch * chore: lint
- Loading branch information
Showing
24 changed files
with
387 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { YTNode } from '../helpers.js'; | ||
import type { RawNode } from '../index.js'; | ||
import { Text } from '../misc.js'; | ||
|
||
export default class FancyDismissibleDialog extends YTNode { | ||
static type = 'FancyDismissibleDialog'; | ||
|
||
dialog_message: Text; | ||
confirm_label: Text; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.dialog_message = new Text(data.dialogMessage); | ||
this.confirm_label = new Text(data.confirmLabel); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { ObservedArray} from '../helpers.js'; | ||
import { YTNode } from '../helpers.js'; | ||
import type { RawNode } from '../index.js'; | ||
import Parser from '../index.js'; | ||
|
||
export default class ProductList extends YTNode { | ||
static type = 'ProductList'; | ||
|
||
contents: ObservedArray<YTNode>; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.contents = Parser.parseArray(data.contents); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { YTNode } from '../helpers.js'; | ||
import type { RawNode } from '../index.js'; | ||
import { Text } from '../misc.js'; | ||
|
||
export default class ProductListHeader extends YTNode { | ||
static type = 'ProductListHeader'; | ||
|
||
title: Text; | ||
suppress_padding_disclaimer: boolean; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.title = new Text(data.title); | ||
this.suppress_padding_disclaimer = !!data.suppressPaddingDisclaimer; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { YTNode } from '../helpers.js'; | ||
import type { RawNode } from '../index.js'; | ||
import Parser from '../index.js'; | ||
import { Text, Thumbnail } from '../misc.js'; | ||
import Button from './Button.js'; | ||
import NavigationEndpoint from './NavigationEndpoint.js'; | ||
|
||
export default class ProductListItem extends YTNode { | ||
static type = 'ProductListItem'; | ||
|
||
title: Text; | ||
accessibility_title: string; | ||
thumbnail: Thumbnail[]; | ||
price: string; | ||
endpoint: NavigationEndpoint; | ||
merchant_name: string; | ||
stay_in_app: boolean; | ||
view_button: Button | null; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.title = new Text(data.title); | ||
this.accessibility_title = data.accessibilityTitle; | ||
this.thumbnail = Thumbnail.fromResponse(data.thumbnail); | ||
this.price = data.price; | ||
this.endpoint = new NavigationEndpoint(data.onClickCommand); | ||
this.merchant_name = data.merchantName; | ||
this.stay_in_app = !!data.stayInApp; | ||
this.view_button = Parser.parseItem(data.viewButton, Button); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { YTNode } from '../helpers.js'; | ||
import type { RawNode } from '../index.js'; | ||
import Parser from '../index.js'; | ||
import TranscriptSearchPanel from './TranscriptSearchPanel.js'; | ||
|
||
export default class Transcript extends YTNode { | ||
static type = 'Transcript'; | ||
|
||
content: TranscriptSearchPanel | null; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.content = Parser.parseItem(data.content, TranscriptSearchPanel); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { YTNode } from '../helpers.js'; | ||
import type { RawNode } from '../index.js'; | ||
import Parser from '../index.js'; | ||
import SortFilterSubMenu from './SortFilterSubMenu.js'; | ||
|
||
export default class TranscriptFooter extends YTNode { | ||
static type = 'TranscriptFooter'; | ||
|
||
language_menu: SortFilterSubMenu | null; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.language_menu = Parser.parseItem(data.languageMenu, SortFilterSubMenu); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { YTNode } from '../helpers.js'; | ||
import type { RawNode } from '../index.js'; | ||
import Parser from '../index.js'; | ||
import Button from './Button.js'; | ||
import NavigationEndpoint from './NavigationEndpoint.js'; | ||
import { Text } from '../misc.js'; | ||
|
||
export default class TranscriptSearchBox extends YTNode { | ||
static type = 'TranscriptSearchBox'; | ||
|
||
formatted_placeholder: Text; | ||
clear_button: Button | null; | ||
endpoint: NavigationEndpoint; | ||
search_button: Button | null; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.formatted_placeholder = new Text(data.formattedPlaceholder); | ||
this.clear_button = Parser.parseItem(data.clearButton, Button); | ||
this.endpoint = new NavigationEndpoint(data.onTextChangeCommand); | ||
this.search_button = Parser.parseItem(data.searchButton, Button); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { YTNode } from '../helpers.js'; | ||
import type { RawNode } from '../index.js'; | ||
import Parser from '../index.js'; | ||
import TranscriptFooter from './TranscriptFooter.js'; | ||
import TranscriptSearchBox from './TranscriptSearchBox.js'; | ||
import TranscriptSegmentList from './TranscriptSegmentList.js'; | ||
|
||
export default class TranscriptSearchPanel extends YTNode { | ||
static type = 'TranscriptSearchPanel'; | ||
|
||
header: TranscriptSearchBox | null; | ||
body: TranscriptSegmentList | null; | ||
footer: TranscriptFooter | null; | ||
target_id: string; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.header = Parser.parseItem(data.header, TranscriptSearchBox); | ||
this.body = Parser.parseItem(data.body, TranscriptSegmentList); | ||
this.footer = Parser.parseItem(data.footer, TranscriptFooter); | ||
this.target_id = data.targetId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { YTNode } from '../helpers.js'; | ||
import type { RawNode } from '../index.js'; | ||
import { Text } from '../misc.js'; | ||
|
||
export default class TranscriptSegment extends YTNode { | ||
static type = 'TranscriptSegment'; | ||
|
||
start_ms: string; | ||
end_ms: string; | ||
snippet: Text; | ||
start_time_text: Text; | ||
target_id: string; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.start_ms = data.startMs; | ||
this.end_ms = data.endMs; | ||
this.snippet = new Text(data.snippet); | ||
this.start_time_text = new Text(data.startTimeText); | ||
this.target_id = data.targetId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { ObservedArray} from '../helpers.js'; | ||
import { YTNode } from '../helpers.js'; | ||
import type { RawNode } from '../index.js'; | ||
import Parser from '../index.js'; | ||
import { Text } from '../misc.js'; | ||
import TranscriptSegment from './TranscriptSegment.js'; | ||
|
||
export default class TranscriptSegmentList extends YTNode { | ||
static type = 'TranscriptSegmentList'; | ||
|
||
initial_segments: ObservedArray<TranscriptSegment>; | ||
no_result_label: Text; | ||
retry_label: Text; | ||
touch_captions_enabled: boolean; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.initial_segments = Parser.parseArray(data.initialSegments, TranscriptSegment); | ||
this.no_result_label = new Text(data.noResultLabel); | ||
this.retry_label = new Text(data.retryLabel); | ||
this.touch_captions_enabled = data.touchCaptionsEnabled; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { YTNode } from '../helpers.js'; | ||
import type { RawNode } from '../index.js'; | ||
import Parser from '../index.js'; | ||
import Factoid from './Factoid.js'; | ||
|
||
export default class UploadTimeFactoid extends YTNode { | ||
static type = 'UploadTimeFactoid'; | ||
|
||
factoid: Factoid | null; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.factoid = Parser.parseItem(data.factoid, Factoid); | ||
} | ||
} |
Oops, something went wrong.