TimeForANinja/node-ytpl

Playlists Links no longer working

phijid opened this issue · 2 comments

Hi there I have noticed that my playlist functionality using this no longer works.

I have found out that the issue lies in the following piece of code in ytpl\lib\util.js:

`exports.getGeneralInfo = (body, plistId) => {
const importantTxt = exports.between(body, 'branded-page-box clearfix', '

');
const authorMatch = importantTxt.match(AUTHOR_REFLINK_REGEXP);
const description = exports.removeHtml(exports.between(
importantTxt,
'',
'
',
).replace(/<button class="yt-uix-button[\s\S]+/, ''));

return {
id: plistId,
url: PLAYLIST_URL + plistId,
title: exports.removeHtml(importantTxt.match(PLAYLIST_NAME_REGEXP)[1]),
visibility: importantTxt.includes('data-tooltip-text="') ? 'link only' : 'everyone',
description: description ? exports.removeHtml(description) : null,
total_items: Number(authorMatch[2].replace(/\D/g, '')),
views: Number(authorMatch[3].replace(/\D/g, '')),
last_updated: authorMatch[4],
author: {
id: exports.between(importantTxt, 'data-all-playlists-url="/channel/', '/playlists"'),
name: exports.removeHtml(exports.between(authorMatch[1], '>', '')),
avatar: exports.between(body, '<img class="channel-header-profile-image" src="', '" title="'),
user: importantTxt.includes('/user/') ? exports.between(authorMatch[1], 'href="/user/', '"') : null,
channel_url: URL.resolve(
PLAYLIST_URL,
/channel/${exports.between(importantTxt, 'data-all-playlists-url="/channel/', '/playlists"')},
),
user_url: importantTxt.includes('/user/') ?
URL.resolve(PLAYLIST_URL, exports.between(authorMatch[1], 'href="', '"')) :
null,
},
nextpage: null,
items: [],
};
};
`

Currently, importantTxt is not getting populated when I send a playlist
Example:
https://www.youtube.com/playlist?list=PLhrG05fbuPKdFR8dBbGPa2k3H3y3rspPS

This is the error I get:
`title: exports.removeHtml(importantTxt.match(PLAYLIST_NAME_REGEXP)[1]),
^

TypeError: Cannot read property '1' of null
at Object.exports.getGeneralInfo (c:\Users\Manny\Documents\Crescendo\node_modules\ytpl\lib\util.js:22:71)
at IncomingMessage. (c:\Users\Manny\Documents\Crescendo\node_modules\ytpl\lib\firstpage.js:30:29)
at IncomingMessage.emit (events.js:322:22)
at endReadableNT (_stream_readable.js:1187:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Process exited with code 1`

can you confirm that you're on latest?
i got a feeling...

marked & closed as stale