diff --git a/examples/track/getInfo_output.txt b/examples/track/getInfo_output.txt index d12643d..5b2cc26 100644 --- a/examples/track/getInfo_output.txt +++ b/examples/track/getInfo_output.txt @@ -4,13 +4,14 @@ url: 'https://musique.coeurdepirate.com/track/tes-belle', imageUrl: 'https://f4.bcbits.com/img/a0774650359_16.jpg', releaseDate: '01 Oct 2020 00:00:00 GMT', - streamUrl: 'https://t4.bcbits.com/stream/63315678db5ea41d2f0417ac7d4f5ca3/mp3-128/3387079907?p=0&ts=1698607859&t=b349661aad9629bae707d365eb932c393b138804&token=1698607859_0403b68818a14c78e0d5380bc24c6002dfb58844', + duration: 176.373, + streamUrl: 'https://t4.bcbits.com/stream/63315678db5ea41d2f0417ac7d4f5ca3/mp3-128/3387079907?p=0&ts=1715075465&t=2e3dcff7f2257606be754e5a0bef4adf51ecdb0e&token=1715075465_2671695edd47716ddaabc2eabff27acb32b6c652', artist: { name: 'Cœur de pirate', url: 'https://musique.coeurdepirate.com' }, publisher: { name: 'Cœur de pirate', url: 'https://musique.coeurdepirate.com', description: 'Plus d’une décennie s’est écoulée depuis que Béatrice Martin s’est incrustée dans le paysage sous le pseudonyme désormais coutumier de Cœur de pirate. Armée d’un talent digne de l’orfèvrerie, d’une poésie tantôt raffinée, tantôt subversive, et d’une aura insaisissable, elle séduit comme elle surprend, jaillissant là où on ne l’attend pas.', - imageUrl: 'https://f4.bcbits.com/img/0026415167_28.jpg' + imageUrl: 'https://f4.bcbits.com/img/0034241766_28.jpg' }, label: { name: 'Bravo musique', url: 'https://bravomusique.bandcamp.com' } } diff --git a/src/lib/track/TrackInfoParser.ts b/src/lib/track/TrackInfoParser.ts index 82b8790..b884a20 100644 --- a/src/lib/track/TrackInfoParser.ts +++ b/src/lib/track/TrackInfoParser.ts @@ -2,7 +2,7 @@ import { load as cheerioLoad } from 'cheerio'; import { decode } from 'html-entities'; import { ImageFormat } from '../types/Image.js'; import Track from '../types/Track.js'; -import { ParseError, getAdditionalPropertyValue, parseLabelFromBackToLabelLink, parsePublisher, reformatImageUrl, splitUrl } from '../utils/Parse.js'; +import { ParseError, parseLabelFromBackToLabelLink, parsePublisher, reformatImageUrl, splitUrl } from '../utils/Parse.js'; import AlbumInfoParser from '../album/AlbumInfoParser.js'; interface TrackInfoParseOptions { @@ -75,7 +75,7 @@ export default class TrackInfoParser { track.releaseDate = extra.current.release_date; } - const duration = getAdditionalPropertyValue(basic, 'duration_secs'); + const duration = extra.trackinfo?.[0]?.duration; if (duration !== undefined) { track.duration = duration; }