diff --git a/appFn.ts b/appFn.ts index 1a3a9b6..e2e8a8e 100644 --- a/appFn.ts +++ b/appFn.ts @@ -97,10 +97,18 @@ const appFn: ApplicationFunction = (app: Probot, { getRouter }) => { if (found) { const html = await spotifyResponse.text(); - const { description } = await getMetaData({ html }); + const { title, description } = await getMetaData({ html }); + + const author = title?.endsWith('Spotify Playlist') + ? 'Spotify' + : title?.match(/(?<=\- playlist by )(.*?)(?= \|)/gm) ?? [ + 'FAILED TO EXTRACT AUTHOR' + ]; + const playlistMeta = (description || '') .split(' · ') - .filter((text) => text !== 'Playlist'); + .filter((text) => text !== 'Playlist') + .concat(author); details = playlistMeta.join(' · '); }