mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-12-23 14:03:35 +00:00
Use map()
instead of for loops
This commit is contained in:
parent
58cd6f8f37
commit
5dbc82168a
@ -1 +0,0 @@
|
||||
Subproject commit 51f030d755a9115f06341ecd78fbbf75ec600059
|
@ -134,10 +134,7 @@ export default {
|
||||
version: 1,
|
||||
playlists: [],
|
||||
};
|
||||
let tasks = [];
|
||||
for (var i = 0; i < this.playlists.length; i++) {
|
||||
tasks.push(this.fetchPlaylistJson(this.playlists[i].id));
|
||||
}
|
||||
let tasks = this.playlists.map(playlist => this.fetchPlaylistJson(playlist.id));
|
||||
json.playlists = await Promise.all(tasks);
|
||||
this.download(JSON.stringify(json), "playlists.json", "application/json");
|
||||
},
|
||||
@ -150,11 +147,8 @@ export default {
|
||||
// as Invidious supports public and private playlists
|
||||
visibility: "private",
|
||||
// list of the videos, starting with "https://youtube.com" to clarify that those are YT videos
|
||||
videos: [],
|
||||
videos: playlist.relatedStreams.map(stream => "https://youtube.com" + stream.url),
|
||||
};
|
||||
for (var i = 0; i < playlist.relatedStreams.length; i++) {
|
||||
playlistJson.videos.push("https://youtube.com" + playlist.relatedStreams[i].url);
|
||||
}
|
||||
return playlistJson;
|
||||
},
|
||||
async importPlaylists() {
|
||||
|
Loading…
Reference in New Issue
Block a user