mirror of
https://github.com/maciejpedzich/playlist-entry-validator.git
synced 2024-11-27 16:05:48 +01:00
Extract playlist author from playlist page title
This commit is contained in:
parent
7c01bab5a4
commit
5ad05aaf7d
12
appFn.ts
12
appFn.ts
@ -97,10 +97,18 @@ const appFn: ApplicationFunction = (app: Probot, { getRouter }) => {
|
|||||||
|
|
||||||
if (found) {
|
if (found) {
|
||||||
const html = await spotifyResponse.text();
|
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 || '')
|
const playlistMeta = (description || '')
|
||||||
.split(' · ')
|
.split(' · ')
|
||||||
.filter((text) => text !== 'Playlist');
|
.filter((text) => text !== 'Playlist')
|
||||||
|
.concat(author);
|
||||||
|
|
||||||
details = playlistMeta.join(' · ');
|
details = playlistMeta.join(' · ');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user