[batoto] replace k-subdomain image URLs with n-subdomain#8791
[batoto] replace k-subdomain image URLs with n-subdomain#8791mikf merged 2 commits intomikf:masterfrom
Conversation
Update tests to use battwo.com proxy domain and current metadata
How long has this maintenance been going on? |
|
That's related the site itself, but not the image servers like mbxma.org as far as I can tell. That aside, do you have an example where the |
|
Sure, here it is https://k07.mbopg.org/media/00005/images/73/44/7344ac7e75fdd842f009c0147354ee3d07f12f0b_166253_1200_863.jpg . I forgot to put a disclaimer that the fix is from their community, they have a bookmark version that you can run in the browser console, i simply translate it to python. setInterval(function(){const fix=str=>str.replace(/\/\/k/g,"//n");document.querySelectorAll("img").forEach(img=>{const props=["src","data-src","data-original","srcset","data-srcset"];props.forEach(p=>{let val=img.getAttribute(p);if(val && val.includes("//k") && val.includes(".mb")){img.setAttribute(p,fix(val));}});if(img.src && img.src.includes("//k") && img.src.includes(".mb")){img.src=fix(img.src);}});},2000);A more detailled version |

Fixes broken image downloads from batoto by automatically replacing k-subdomain image URLs with n-subdomain equivalents.
Batoto's k-subdomain image servers (e.g.,
k01.mbopg.org) are currently broken and return errors. The n-subdomain servers (e.g.,n01.mbopg.org) serve the same images and are working correctly.Example
Before:
https://k01.mbopg.org/media/7006/9bd/.../file.webpAfter:
https://n01.mbopg.org/media/7006/9bd/.../file.webp