diff --git a/src/components/HistoryPage.vue b/src/components/HistoryPage.vue
index 0d65910b..3c650b8e 100644
--- a/src/components/HistoryPage.vue
+++ b/src/components/HistoryPage.vue
@@ -4,6 +4,8 @@
+
+
@@ -71,6 +73,22 @@ export default {
}
this.videos = [];
},
+ exportHistory() {
+ const dateStr = new Date().toISOString().split(".")[0];
+ let json = {
+ format: "Piped",
+ version: 1,
+ playlists: [
+ {
+ name: `Piped History ${dateStr}`,
+ type: "history",
+ visibility: "private",
+ videos: this.videos.map(video => "https://youtube.com" + video.url),
+ },
+ ],
+ };
+ this.download(JSON.stringify(json), `piped_history_${dateStr}.json`, "application/json");
+ },
},
};
diff --git a/src/main.js b/src/main.js
index 12cf63ef..7aa789d9 100644
--- a/src/main.js
+++ b/src/main.js
@@ -241,8 +241,8 @@ const mixin = {
return localSubscriptions.join(",");
},
/* generate a temporary file and ask the user to download it */
- download(text, filename, type) {
- var file = new Blob([text], { type: type });
+ download(text, filename, mimeType) {
+ var file = new Blob([text], { type: mimeType });
const elem = document.createElement("a");