1
0
mirror of https://github.com/TeamPiped/Piped.git synced 2024-12-13 22:00:28 +05:30

Add support for Google Takeout CSV

Closes #320
This commit is contained in:
FireMasterK 2021-07-27 23:14:31 +05:30
parent 960f5d414c
commit dcf6e672a9
No known key found for this signature in database
GPG Key ID: 49451E4482CC5BCD

View File

@ -104,7 +104,7 @@ export default {
const json = JSON.parse(text);
this.subscriptions = json.subscriptions;
}
// Google Takeout
// Google Takeout JSON
if (text.indexOf("contentDetails") != -1) {
const json = JSON.parse(text);
json.forEach(item => {
@ -112,6 +112,16 @@ export default {
this.subscriptions.push(id);
});
}
// Google Takeout CSV
if (text.indexOf("Channel Id,") != -1) {
const lines = text.split("\n");
for (let i = 1; i < lines.length; i++) {
const line = lines[i];
const id = line.substr(0, line.indexOf(","));
if (id.length === 24) this.subscriptions.push(id);
}
}
});
},
handleImport() {