mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-26 08:08:54 +00:00
refactor!: rewrite Analytics to TypeScript (#122)
* refactor: migrate all analytics’ classes to TypeScript Also, add AnalyticsShortsCarouselCard and AnalyticsRoot.
This commit is contained in:
18
src/parser/classes/analytics/AnalyticsMainAppKeyMetrics.ts
Normal file
18
src/parser/classes/analytics/AnalyticsMainAppKeyMetrics.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import DataModelSection from './DataModelSection';
|
||||
import { YTNode } from '../../helpers';
|
||||
|
||||
class AnalyticsMainAppKeyMetrics extends YTNode {
|
||||
static type = 'AnalyticsMainAppKeyMetrics';
|
||||
|
||||
period: string;
|
||||
sections: DataModelSection[];
|
||||
|
||||
constructor(data: any) {
|
||||
super();
|
||||
this.period = data.cardData.periodLabel;
|
||||
const metrics_data = data.cardData.sections[0].analyticsKeyMetricsData;
|
||||
this.sections = metrics_data.dataModel.sections.map((section: any) => new DataModelSection(section));
|
||||
}
|
||||
}
|
||||
|
||||
export default AnalyticsMainAppKeyMetrics;
|
||||
Reference in New Issue
Block a user