mirror of
https://github.com/d-fi/d-fi-core.git
synced 2025-07-27 07:34:42 +02:00
playlist channel
This commit is contained in:
parent
f2592a267d
commit
2d4d17ef9f
110
src/api.ts
110
src/api.ts
@ -7,6 +7,7 @@ import type {
|
|||||||
albumTracksType,
|
albumTracksType,
|
||||||
playlistInfo,
|
playlistInfo,
|
||||||
playlistTracksType,
|
playlistTracksType,
|
||||||
|
playlistChannelType,
|
||||||
artistInfoType,
|
artistInfoType,
|
||||||
discographyType,
|
discographyType,
|
||||||
profileType,
|
profileType,
|
||||||
@ -181,3 +182,112 @@ export const getUser = async (): Promise<userType> => {
|
|||||||
const errorMessage = Object.entries(error).join(', ');
|
const errorMessage = Object.entries(error).join(', ');
|
||||||
throw new Error(errorMessage);
|
throw new Error(errorMessage);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get details about a playlist channel
|
||||||
|
*/
|
||||||
|
export const getPlaylistChannel = async (name: string): Promise<playlistChannelType> => {
|
||||||
|
const gateway_input = {
|
||||||
|
page: 'channels/' + name,
|
||||||
|
version: '2.3',
|
||||||
|
support: {
|
||||||
|
'long-card-horizontal-grid': ['album', 'playlist', 'radio', 'show', 'livestream'],
|
||||||
|
ads: ['native'],
|
||||||
|
message: ['conversion', 'informative', 'call_onboarding'],
|
||||||
|
highlight: ['generic', 'album', 'artist', 'playlist', 'radio', 'livestream', 'app'],
|
||||||
|
'deeplink-list': ['generic', 'deeplink'],
|
||||||
|
grid: [
|
||||||
|
'generic',
|
||||||
|
'album',
|
||||||
|
'artist',
|
||||||
|
'playlist',
|
||||||
|
'radio',
|
||||||
|
'channel',
|
||||||
|
'show',
|
||||||
|
'livestream',
|
||||||
|
'page',
|
||||||
|
'smarttracklist',
|
||||||
|
'flow',
|
||||||
|
'video-link',
|
||||||
|
],
|
||||||
|
slideshow: [
|
||||||
|
'album',
|
||||||
|
'artist',
|
||||||
|
'playlist',
|
||||||
|
'radio',
|
||||||
|
'show',
|
||||||
|
'livestream',
|
||||||
|
'channel',
|
||||||
|
'video-link',
|
||||||
|
'external-link',
|
||||||
|
],
|
||||||
|
'large-card': [
|
||||||
|
'generic',
|
||||||
|
'album',
|
||||||
|
'artist',
|
||||||
|
'playlist',
|
||||||
|
'radio',
|
||||||
|
'show',
|
||||||
|
'livestream',
|
||||||
|
'external-link',
|
||||||
|
'video-link',
|
||||||
|
],
|
||||||
|
'item-highlight': ['radio', 'app'],
|
||||||
|
'small-horizontal-grid': ['album', 'artist', 'playlist', 'radio', 'channel', 'show', 'livestream'],
|
||||||
|
'grid-preview-two': [
|
||||||
|
'generic',
|
||||||
|
'album',
|
||||||
|
'artist',
|
||||||
|
'playlist',
|
||||||
|
'radio',
|
||||||
|
'channel',
|
||||||
|
'show',
|
||||||
|
'livestream',
|
||||||
|
'page',
|
||||||
|
'smarttracklist',
|
||||||
|
'flow',
|
||||||
|
'video-link',
|
||||||
|
],
|
||||||
|
list: ['generic', 'album', 'artist', 'playlist', 'radio', 'show', 'video-link', 'channel', 'episode'],
|
||||||
|
'grid-preview-one': [
|
||||||
|
'generic',
|
||||||
|
'album',
|
||||||
|
'artist',
|
||||||
|
'playlist',
|
||||||
|
'radio',
|
||||||
|
'channel',
|
||||||
|
'show',
|
||||||
|
'livestream',
|
||||||
|
'page',
|
||||||
|
'smarttracklist',
|
||||||
|
'flow',
|
||||||
|
'video-link',
|
||||||
|
],
|
||||||
|
'horizontal-grid': [
|
||||||
|
'generic',
|
||||||
|
'album',
|
||||||
|
'artist',
|
||||||
|
'playlist',
|
||||||
|
'radio',
|
||||||
|
'channel',
|
||||||
|
'show',
|
||||||
|
'livestream',
|
||||||
|
'video-link',
|
||||||
|
'smarttracklist',
|
||||||
|
'flow',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
lang: 'en',
|
||||||
|
timezone_offset: '6',
|
||||||
|
};
|
||||||
|
const {
|
||||||
|
data: {error, results},
|
||||||
|
} = await axios.get('/gateway.php', {params: {method: 'app_page_get', gateway_input}});
|
||||||
|
|
||||||
|
if (Object.keys(results).length > 0) {
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
const errorMessage = Object.entries(error).join(', ');
|
||||||
|
throw new Error(errorMessage);
|
||||||
|
};
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
export * from './album';
|
export * from './album';
|
||||||
export * from './artist';
|
export * from './artist';
|
||||||
export * from './playlist';
|
export * from './playlist';
|
||||||
|
export * from './playlist-channel';
|
||||||
export * from './profile';
|
export * from './profile';
|
||||||
export * from './search';
|
export * from './search';
|
||||||
export * from './tracks';
|
export * from './tracks';
|
||||||
|
65
src/types/playlist-channel.ts
Normal file
65
src/types/playlist-channel.ts
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
interface itemsType {
|
||||||
|
item_id: string; // 'page_id=channels/dance,render_id=608a93738223d615200e6390ea48f8f3,version=channel-cms.1.0,section_id=long-card-horizontal-grid,section_position=0,module_id=be55d60e-e3c3-421a-9ea9-aef6f0c63c6c,module_type=playlists,layout=playlists_layout_long-card-horizontal-grid,content_source=playlists_content-source_custom,content_source_count=0,content_programming_count=8,section_content=playlist%3A1291471565%3Bplaylist%3A2249258602%3Bplaylist%3A2113355604%3Bplaylist%3A1950512362%3Bplaylist%3A1495242491%3Bplaylist%3A6090195324%3Bplaylist%3A706093725%3Bplaylist%3A7837492422,item_type=playlist,item_id=1291471565,item_position=0'
|
||||||
|
id: string; // '1291471565'
|
||||||
|
type: 'playlist';
|
||||||
|
data: {
|
||||||
|
NB_FAN: number; // 231133
|
||||||
|
NB_SONG: number; // 50
|
||||||
|
PARENT_USER_ID: string; // '2834392844'
|
||||||
|
PICTURE_TYPE: 'playlist';
|
||||||
|
PLAYLIST_ID: string; // '1291471565'
|
||||||
|
PLAYLIST_PICTURE: string; // 'c5eb1bf10a83734c032e983ef190105e'
|
||||||
|
STATUS: number; // 0
|
||||||
|
TITLE: string; // 'Dance Party'
|
||||||
|
TYPE: string; // '0'
|
||||||
|
DATE_MOD: string; // '2021-04-02 19:57:27'
|
||||||
|
DATE_ADD: string; // '2020-12-15 19:31:07'
|
||||||
|
DESCRIPTION: string; // 'The biggest dance hits to keep the party going!'
|
||||||
|
__TYPE__: 'playlist';
|
||||||
|
};
|
||||||
|
target: string; // '/playlist/1291471565'
|
||||||
|
title: string; // 'Dance Party'
|
||||||
|
subtitle: string; // '50 tracks'
|
||||||
|
description: string; // 'The biggest dance hits to keep the party going!'
|
||||||
|
pictures: [
|
||||||
|
{
|
||||||
|
md5: string; // 'c5eb1bf10a83734c032e983ef190105e'
|
||||||
|
type: 'playlist';
|
||||||
|
},
|
||||||
|
];
|
||||||
|
weight: number; // 1
|
||||||
|
layout_parameters: {
|
||||||
|
cta: {
|
||||||
|
type: 'browse';
|
||||||
|
label: 'BROWSE';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
interface sectionsType {
|
||||||
|
layout: string; // 'long-card-horizontal-grid'
|
||||||
|
section_id: string; // 'page_id=channels/dance,render_id=608a93738223d615200e6390ea48f8f3,version=channel-cms.1.0,section_id=long-card-horizontal-grid,section_position=0,module_id=be55d60e-e3c3-421a-9ea9-aef6f0c63c6c,module_type=playlists,layout=playlists_layout_long-card-horizontal-grid,content_source=playlists_content-source_custom,content_source_count=0,content_programming_count=8,section_content=playlist%3A1291471565%3Bplaylist%3A2249258602%3Bplaylist%3A2113355604%3Bplaylist%3A1950512362%3Bplaylist%3A1495242491%3Bplaylist%3A6090195324%3Bplaylist%3A706093725%3Bplaylist%3A7837492422'
|
||||||
|
items: itemsType[];
|
||||||
|
title: string; // 'Top Dance & EDM playlists'
|
||||||
|
target: string; // '/channels/module/be55d60e-e3c3-421a-9ea9-aef6f0c63c6c'
|
||||||
|
related: {
|
||||||
|
target: string; // '/channels/module/be55d60e-e3c3-421a-9ea9-aef6f0c63c6c'
|
||||||
|
label: string; // 'View all'
|
||||||
|
mandatory: boolean;
|
||||||
|
};
|
||||||
|
alignment: string; // 'left'
|
||||||
|
group_id: string; // '606c10eda2d91'
|
||||||
|
hasMoreItems: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface playlistChannelType {
|
||||||
|
version: string; // '2.3'
|
||||||
|
page_id: string; // 'page_id=channels/dance,render_id=608a93738223d615200e6390ea48f8f3,version=channel-cms.1.0'
|
||||||
|
ga: {
|
||||||
|
screen_name: string; // 'page-dance'
|
||||||
|
};
|
||||||
|
title: string; // 'Dance & EDM'
|
||||||
|
persistent: boolean;
|
||||||
|
sections: sectionsType[];
|
||||||
|
expire: number; // 1617707131
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user