Added to Library error

Joined
Sep 21, 2020
Messages
53
I've been sorting through my library and I think I have discovered a bug. Where a manga will say "Add to Library" or "Reading" or "Completed" instead it reads "Added to Library" with the bell and checkmark. The thing is that I have no way to see these manga, they don't show up in my library under any category. I would like to know if anyone has encountered this before, and or if there is a way to easily see all of the manga under this.
 
Solution
I've been sorting through my library and I think I have discovered a bug. Where a manga will say "Add to Library" or "Reading" or "Completed" instead it reads "Added to Library" with the bell and checkmark. The thing is that I have no way to see these manga, they don't show up in my library under any category. I would like to know if anyone has encountered this before, and or if there is a way to easily see all of the manga under this.

With the advent of CustomLists on the horizon it's possible that this is a pointless endeavor as it might fix all the entries during the transition.. however, i was too curious to see how many i had since i'd seen them before and so i set out and wrote a short script which you can use if...
File Attacher
Staff
Super Moderator
Joined
Jan 20, 2018
Messages
256
I've been sorting through my library and I think I have discovered a bug. Where a manga will say "Add to Library" or "Reading" or "Completed" instead it reads "Added to Library" with the bell and checkmark. The thing is that I have no way to see these manga, they don't show up in my library under any category. I would like to know if anyone has encountered this before, and or if there is a way to easily see all of the manga under this.

With the advent of CustomLists on the horizon it's possible that this is a pointless endeavor as it might fix all the entries during the transition.. however, i was too curious to see how many i had since i'd seen them before and so i set out and wrote a short script which you can use if you wish
(I had 11, but also an old account following a bit over 2k series)

This will most DEFINITELY break once the CustomLists are actually out so don't use it at that point..

To use, on a mangadex.org tab where you're logged in, open the devtools (typically f12 or rightclick somewhere > inspect element ) and go to the Console and copy paste the below code and press enter, this will automatically try and fix the affected series by setting them to reading, if you don't want that and just want links to them then remove the for ... loop at the bottom (starting from the beginning of for(let uuid of diff){ to and including the } just above the console.log('\nDone!'))
JavaScript:
{
    console.log('Grabbing Statuses.');
    let _token = JSON.parse(localStorage.getItem("oidc.user:https://auth.mangadex.org/realms/mangadex:mangadex-frontend-stable")).access_token;
    let statusRes = (await (await fetch("https://api.mangadex.org/manga/status",{headers:{Authorization:"Bearer "+_token}})).json());
    let statuses = Object.keys(statusRes.statuses);
    await new Promise((rs)=>{setTimeout(rs,200)});
    
    console.log('Grabbing Follows:\n ');
    let _offset, _resTotal;
    _offset = _resTotal    = 0;
    let follows = [];
    do{
            let rls = Date.now();
            let res = (await (await fetch("https://api.mangadex.org/user/follows/manga?limit=100&offset="+_offset,{headers:{Authorization:"Bearer "+_token}})).json());
            _resTotal = res.total;
            follows.push(...res.data.map(m => m.id))
            _offset += 100;
            console.log('Follows %o/%o',Math.min(_offset,_resTotal),_resTotal)
            if(res.data.length == 0) _offset++;
            let rld = Date.now() - rls;
            if(rld < 200) await new Promise((rs)=>{setTimeout(rs,200-rld)});
    }while(_resTotal - _offset > 0)
    console.log(' ')
    let diff = follows.filter(id => !statuses.includes(id));
    
    console.log("Statuses: %o Follows: %o/%o (%o deleted entries?) Bugged Statuses: %o",statuses.length,follows.length,_resTotal,_resTotal-follows.length,diff.length);
    
    if(diff.length > 0){
        console.log("\n"+(diff.map(id => "https://mangadex.org/title/"+id).join('\n'))+'\n\nAttemping to set as Reading.\n ');
        for(let uuid of diff){
            let rls = Date.now();
            let res = (await fetch("https://api.mangadex.org/manga/"+uuid+"/status",{method: "POST", headers:{"Content-Type": "application/json", Authorization:"Bearer "+_token}, body: JSON.stringify({status:'reading'})}));
            console.log('*POST* for %s returned %o %s',uuid,res.status,(res.status==200)?'Fixed!':'Not Fixed.')
            let rld = Date.now() - rls;
            if(rld < 200) await new Promise((rs)=>{setTimeout(rs,200-rld)});
        }
        console.log('\nDone!')
    }
}
 
Solution
Joined
Sep 21, 2020
Messages
53
With the advent of CustomLists on the horizon it's possible that this is a pointless endeavor as it might fix all the entries during the transition.. however, i was too curious to see how many i had since i'd seen them before and so i set out and wrote a short script which you can use if you wish
(I had 11, but also an old account following a bit over 2k series)

This will most DEFINITELY break once the CustomLists are actually out so don't use it at that point..

To use, on a mangadex.org tab where you're logged in, open the devtools (typically f12 or rightclick somewhere > inspect element ) and go to the Console and copy paste the below code and press enter, this will automatically try and fix the affected series by setting them to reading, if you don't want that and just want links to them then remove the for ... loop at the bottom (starting from the beginning of for(let uuid of diff){ to and including the } just above the console.log('\nDone!'))
JavaScript:
{
    console.log('Grabbing Statuses.');
    let _token = JSON.parse(localStorage.getItem("oidc.user:https://auth.mangadex.org/realms/mangadex:mangadex-frontend-stable")).access_token;
    let statusRes = (await (await fetch("https://api.mangadex.org/manga/status",{headers:{Authorization:"Bearer "+_token}})).json());
    let statuses = Object.keys(statusRes.statuses);
    await new Promise((rs)=>{setTimeout(rs,200)});
   
    console.log('Grabbing Follows:\n ');
    let _offset, _resTotal;
    _offset = _resTotal    = 0;
    let follows = [];
    do{
            let rls = Date.now();
            let res = (await (await fetch("https://api.mangadex.org/user/follows/manga?limit=100&offset="+_offset,{headers:{Authorization:"Bearer "+_token}})).json());
            _resTotal = res.total;
            follows.push(...res.data.map(m => m.id))
            _offset += 100;
            console.log('Follows %o/%o',Math.min(_offset,_resTotal),_resTotal)
            if(res.data.length == 0) _offset++;
            let rld = Date.now() - rls;
            if(rld < 200) await new Promise((rs)=>{setTimeout(rs,200-rld)});
    }while(_resTotal - _offset > 0)
    console.log(' ')
    let diff = follows.filter(id => !statuses.includes(id));
   
    console.log("Statuses: %o Follows: %o/%o (%o deleted entries?) Bugged Statuses: %o",statuses.length,follows.length,_resTotal,_resTotal-follows.length,diff.length);
   
    if(diff.length > 0){
        console.log("\n"+(diff.map(id => "https://mangadex.org/title/"+id).join('\n'))+'\n\nAttemping to set as Reading.\n ');
        for(let uuid of diff){
            let rls = Date.now();
            let res = (await fetch("https://api.mangadex.org/manga/"+uuid+"/status",{method: "POST", headers:{"Content-Type": "application/json", Authorization:"Bearer "+_token}, body: JSON.stringify({status:'reading'})}));
            console.log('*POST* for %s returned %o %s',uuid,res.status,(res.status==200)?'Fixed!':'Not Fixed.')
            let rld = Date.now() - rls;
            if(rld < 200) await new Promise((rs)=>{setTimeout(rs,200-rld)});
        }
        console.log('\nDone!')
    }
}
This worked perfectly! Thank you so much!
 

Users who are viewing this thread

Top