I wanna be able to export my library into a file

Dex-chan lover
Joined
May 16, 2019
Messages
1,004
The main thing I missed when the site went down was my Manga follows. I couldn't work with the API and login through that. It'd be great if the website had an option to let me download my follows to a file to keep as backup, even a simple text file.

I see there was a support thread about this topic, but I don't think it's been actually suggested yet.
 
Upvote 11
Joined
Feb 16, 2023
Messages
18
I am going to be honest i thought that was already implemented which was why i joined, i had seen it it stated that you could do that with Mangadex before and though that the site focused on curation and cataloguing manga's one was interested in as there selling point.
 
File Attacher
Staff
Super Moderator
Joined
Jan 20, 2018
Messages
288
but I don't think it's been actually suggested yet.
Well actually..
Edit: well actually not.. i only looked at when the post above mine was made and not the thread itself, this one is 4 days earlier than the one i linked :huh:

But anyway, the only talk i've seen about it is this "maybe something in the far future" is this ↓
andku85 said on Discord: ->

I have a suggestion for the site. Is there we can have a backup option. Like to Google Drive, Drop Box or something. That would export our lists; reading, plan to read, on hold, etc. And also our favorites. Would be a few Json files in a folder. And later down the line an import if something happens. No need for a daily but maybe a weekly or 2ice a month or even monthly. Like i said a suggestion.

Tristan 9 said on Discord: ->

No need for a daily but maybe a weekly or 2ice a month or even monthly.
We might do it in the future, but you'd definitely have to click a button at least; we will never initiate a connection to another server from within ours.

Would be a few Json files in a folder.
Now you also have to remember that as far as MangaDex is concerned, all things are just using our IDs, so it wouldn't be compatible with 3rd-party websites/apps without work on their side and them keeping track of our ids, which isn't going to be something anyone wants to do (there's a reason we don't keep track of other sites' ids either).
At the point where someone actually goes and does that, we have a public API they can pull your data from for backup purposes.

And later down the line an import if something happens.
Finally, we safekeep the accounts on our platform, but if worst comes to worse and MD goes poof, then there's nowhere for us to help you import that data back, since we went poof.

Overall it's something that would be really nice to have, but:
  • technically all feasible to export your account data as-is right now
  • guaranteeing that you can make use of the backups later isn't something we can do ourselves, since it's a "what if MD dies" thing

andku85 said on Discord: ->

For me i say backup but it is mostly so i can have a self record. If it's a button i click to download or load somewhere. To me that's more than enough. Just want to keep organized. And thank you for your reply.

Tristan 9 said on Discord: ->

Well, then we can probably do that eventually. But I can't stress enough that it most likely wouldn't be useful in a worst case scenario, and we don't want to give a false sense of security in that regard 😅
(Preferably i'd like only a single quote but context and whatnot.. also, jesus this took so long..)
 
Last edited:
Dex-chan lover
Joined
May 16, 2019
Messages
1,004
I am going to be honest i thought that was already implemented which was why i joined, i had seen it it stated that you could do that with Mangadex before and though that the site focused on curation and cataloguing manga's one was interested in as there selling point.
It does catalogue Manga for you, and it's nice to use. The problem is that if the website goes down it's a huge bummer because you lose the only place you had saved all the stuff you planned to read some day.
I'd like an option to backup the catalogue so I always have it. I'm kinda lazy to do it manually myself.


Well actually..
Edit: well actually not.. i only looked at when the post above mine was made and not the thread itself, this one is 4 days earlier than the one i linked :huh:

But anyway, the only talk i've seen about it is this "maybe something in the far future" is this ↓
(Preferably i'd like only a single quote but context and whatnot.. also, jesus this took so long..)
That's fair. For now I could get over myself and just screenshot my list.. Or just hope the website doesn't get HOMBRE'd again...
 
Staff
Developer
Joined
Dec 29, 2024
Messages
9
If we export the library in a file, that file would need to follow some format. I assume what makes the most sense is JSON.
In that file, is the status (reading, plan to read, etc.), id, and URL would be enough?
Here's an example:
JSON:
{
    "library": {
        "reading": [
            {
                "id": "[...]",
                "url": "https://mangadex.org/..."
            },
            {
                "id": "[...]",
                "url": "https://mangadex.org/..."
            },
            // ...
        ],
        "plan_to_read": [
            {
                "id": "[...]",
                "url": "https://mangadex.org/..."
            },
            // ...
        ],
        // ...
    }
}

Of course, if we do that, we'll also host a JSON schema people can download so that they can programmatically know what to expect from that file.
 
Contributor
Joined
Jan 19, 2018
Messages
594
In that file, is the status (reading, plan to read, etc.), id, and URL would be enough?
I imagine most people want an export to handle the case of if/when MD goes away forever.
reading status and id are fine, but URL is kind of pointless to me. To make it useful for a person to read the main title(s) should also be included. I also don't care for the grouping by status, but thats probably just me.

JSON:
{
    "count": 1,
    "library": [
        {
            "id": "00000000-0000-0000-0000-000000000000",
            "tile": {
                "en":"SOME_EN_TITLE",
                "ja-ro":"SOME_JA-RO_TITLE",
                "ja":"SOME_JA_TITLE",
            },
            "status":"plan_to_read",
        }
    ]
}
 
Member
Joined
Jan 16, 2023
Messages
33
So it's planned? or only a suggestion like said at the top. I also don't want to loss all my lists, and would like to share it with some friends without having the burden of writting every title on a notepad and keep it updated. :haa:
 
Contributor
Joined
Jan 19, 2018
Messages
594
For those that don't mind a slow and kind of janky export method here is some JS that can be run in the browser console while on mangadex to export your library as a CSV

Note: This is slow and not very well tested so use at your own risk
JavaScript:
async function GetLibrary(readingStatus) {
    const baseUrl = 'https://api.mangadex.org';
    const authToken = JSON.parse(localStorage.getItem('oidc.user:https://auth.mangadex.org/realms/mangadex:mangadex-frontend-stable')).access_token;
    
    let fetchUrl = `${baseUrl}/manga/status`;
    
    if(readingStatus !== '')
        fetchUrl = `${fetchUrl}?status=${readingStatus}`
    
    let response = await fetch(fetchUrl, {
        method: 'GET',
        headers: {
            'Content-Type': 'application/json',
            'Authorization': `Bearer ${authToken}`,
        },
    });
    return await response.json();
}

async function GetTitle(titleId) {
    const baseUrl = 'https://api.mangadex.org';
    
    let response = await fetch(`${baseUrl}/manga/${titleId}`, {
        method: 'GET',
        headers: {
            'Content-Type': 'application/json',
        },
    });
    
    const result = await response.json();
    return result.data.attributes.title;
}

function Sleep(milliseconds) {
    return new Promise((resolve) => setTimeout(resolve, milliseconds))
}

function MakeCsvData(libData) {
    const csvRows = [];   
    const headers = Object.keys(libData[0]);
    
    csvRows.push(headers.join(','));
    for(const item of libData) {
        const values = headers.map((e) => {
            if(e === 'title') {
                const temp = item[e].replaceAll('"', '""');
                return `"${temp}"`;
            }
            return item[e];
        });
        csvRows.push(values.join(','));
    }
    return csvRows.join('\n');
}

function DownloadCsv(csvData) {
    const blob = new Blob([csvData], {type:'text/csv'});
    const url = URL.createObjectURL(blob);
    const a = document.createElement('a');
    a.href = url;
    a.download = 'library.csv';
    a.click();
}

(async () => {
    const readingStatus = 'reading';
    //const readingStatus = 'plan_to_read';
    //const readingStatus = 'on_hold';
    //const readingStatus = 'dropped';
    //const readingStatus = 're_reading';
    //const readingStatus = 'completed';
    //const readingStatus = ''; // empty for all titles
    const result = await GetLibrary(readingStatus);
    const libInfo = [];
    for(const id in result.statuses) {
        const titles = await GetTitle(id);
        const title = Object.hasOwn(titles, 'en') ? titles['en'] : titles[Object.keys(titles)[0]];
        const status = result.statuses[id]
        
        //console.log(`${title} (${id}) : ${status}`);
        libInfo.push({title:title, id:id, status:status})
        await Sleep(300);
    }
    
    //console.log(libInfo);
    DownloadCsv(MakeCsvData(libInfo));
})();
 

Users who are viewing this thread

Top