mirror of
https://github.com/maciejpedzich/playlist-entry-validator.git
synced 2024-11-27 16:05:48 +01:00
Compare commits
No commits in common. "f2c99ea418753d87142a8d7603e1af1a5fd1cbc3" and "4ecd9df6286ca27324ee47f85738c2989bf91a39" have entirely different histories.
f2c99ea418
...
4ecd9df628
53
appFn.ts
53
appFn.ts
@ -132,11 +132,7 @@ const appFn: ApplicationFunction = (app: Probot, { getRouter }) => {
|
|||||||
|
|
||||||
if (found) {
|
if (found) {
|
||||||
const html = await spotifyResponse.text();
|
const html = await spotifyResponse.text();
|
||||||
const {
|
const { author: authorUrl, description } = await getMetaData({
|
||||||
// author: authorUrl,
|
|
||||||
description,
|
|
||||||
title
|
|
||||||
} = await getMetaData({
|
|
||||||
html,
|
html,
|
||||||
customRules: {
|
customRules: {
|
||||||
author: {
|
author: {
|
||||||
@ -150,39 +146,32 @@ const appFn: ApplicationFunction = (app: Probot, { getRouter }) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// let authorName = (authorUrl as string).endsWith('/user/spotify')
|
let authorName = (authorUrl as string).endsWith('/user/spotify')
|
||||||
// ? 'Spotify'
|
? 'Spotify'
|
||||||
// : '';
|
: '';
|
||||||
|
|
||||||
// if (authorName === '') {
|
if (authorName === '') {
|
||||||
// const playlistAuthorResponse = await fetch(authorUrl as string);
|
const playlistAuthorResponse = await fetch(authorUrl as string);
|
||||||
|
|
||||||
// if (!playlistAuthorResponse.ok)
|
if (!playlistAuthorResponse.ok)
|
||||||
// throw new Error(
|
throw new Error(
|
||||||
// `Received ${playlistAuthorResponse.status} status code from ${authorUrl}`
|
`Received ${playlistAuthorResponse.status} status code from ${authorUrl}`
|
||||||
// );
|
);
|
||||||
|
|
||||||
// const authorPageHtml = await playlistAuthorResponse.text();
|
const authorPageHtml = await playlistAuthorResponse.text();
|
||||||
// const { title: authorPageTitle } = await getMetaData({
|
const { title: authorPageTitle } = await getMetaData({
|
||||||
// html: authorPageHtml
|
html: authorPageHtml
|
||||||
// });
|
});
|
||||||
|
|
||||||
// authorName = authorPageTitle as string;
|
authorName = authorPageTitle as string;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// const playlistMeta = (description || '')
|
const playlistMeta = (description || '')
|
||||||
// .split(' · ')
|
.split(' · ')
|
||||||
// .filter((text) => text !== 'Playlist')
|
.filter((text) => text !== 'Playlist')
|
||||||
// .concat(authorName as string);
|
.concat(authorName as string);
|
||||||
|
|
||||||
// details = playlistMeta.join(' · ');
|
details = playlistMeta.join(' · ');
|
||||||
details = (
|
|
||||||
title +
|
|
||||||
' · ' +
|
|
||||||
description!.replace('Playlist · ', '')
|
|
||||||
)
|
|
||||||
.replace(/\s+/g, ' ')
|
|
||||||
.trim();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
numProcessedEntries++;
|
numProcessedEntries++;
|
||||||
|
Loading…
Reference in New Issue
Block a user