https://github.com/matrix-org/synapse/blob/develop/synapse/rest/media/v1/preview_url_resource.py
I think this kinda demonstrates an important point of why NPM's module system is so good.
Now Synapse (python) has a full opengraph/html parser, almost a thousand lines of code, for a minimal feature in the API, and it barely works...
Instead this could have been a nice, self-contained library properly updated and shared between lots of projects
https://blog.sindresorhus.com/small-focused-modules-9238d977a92a