|
|
@ -28,21 +28,22 @@ export const exploreVideos = async (videoId, onUpdate) => |
|
|
|
while (queue.length > 0) |
|
|
|
{ |
|
|
|
const currentId = queue.shift(); |
|
|
|
const config = await api.getPlayerConfig(currentId); |
|
|
|
const meta = api.getVideoMeta(config); |
|
|
|
|
|
|
|
videosNodes[currentId] = meta; |
|
|
|
nextVideos[currentId] = new Set(); |
|
|
|
if (!(currentId in videosNodes)) |
|
|
|
{ |
|
|
|
const config = await api.getPlayerConfig(currentId); |
|
|
|
const meta = api.getVideoMeta(config); |
|
|
|
|
|
|
|
// Add links between this video and the linked ones
|
|
|
|
api.getEndScreenVideos(config) |
|
|
|
.forEach(nextId => nextVideos[meta.videoId].add(nextId)); |
|
|
|
api.getCardVideos(config) |
|
|
|
.forEach(nextId => nextVideos[meta.videoId].add(nextId)); |
|
|
|
videosNodes[currentId] = meta; |
|
|
|
nextVideos[currentId] = new Set(); |
|
|
|
|
|
|
|
for (let nextId of nextVideos[meta.videoId]) |
|
|
|
{ |
|
|
|
if (!(nextId in videosNodes)) |
|
|
|
// Add links between this video and the linked ones
|
|
|
|
api.getEndScreenVideos(config) |
|
|
|
.forEach(nextId => nextVideos[meta.videoId].add(nextId)); |
|
|
|
api.getCardVideos(config) |
|
|
|
.forEach(nextId => nextVideos[meta.videoId].add(nextId)); |
|
|
|
|
|
|
|
for (let nextId of nextVideos[meta.videoId]) |
|
|
|
{ |
|
|
|
queue.push(nextId); |
|
|
|
} |
|
|
|