florimondmanca / www

Code for https://florimond.dev
MIT License
32 stars 10 forks source link

Drop Twitter #463

Closed florimondmanca closed 11 months ago

florimondmanca commented 11 months ago

Twitter URLs in posts were replaced with Nitter equivalents using this one-off script:

import asyncio
import re

from server.infrastructure.content import aiter_blog_posting_paths

async def main() -> None:
    async for _, path in aiter_blog_posting_paths():
        content = path.read_text()
        lines = content.splitlines(keepends=True)

        for i, line in enumerate(lines):
            lines[i] = re.sub("https://twitter.com", "https://nitter.net", line)

        path.write_text("".join(lines))

if __name__ == "__main__":
    asyncio.run(main())