INNER CODE UNIT · Python

check_all

SuperAB123/Free-Official-Youtube-Content · Find broken links in the list.py:30

async def check_all(links: list[str], concurrency: int = 40):
    broken = []
    connector = aiohttp.TCPConnector(limit_per_host=concurrency, ssl=False)
    async with aiohttp.ClientSession(connector=connector) as session:
        sem = asyncio.Semaphore(concurrency)

        async def worker(link):
            async with sem:
                ok = await check_link(session, link)
                print(f"{'✅' if ok else '❌'} {link}")
                if not ok:
                    broken.append(link)

        await asyncio.gather(*(worker(l) for l in links))
    return broken

async def main():
    links = extract_links_from_readme("README.md")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…