INNER CODE UNIT · Python
worker
SuperAB123/Free-Official-Youtube-Content · Find broken links in the list.py:36
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")
print(f"Found {len(links)} links\n")
if not links:
return
broken = await check_all(links)
if broken:
async with aio_open("broken_links2.txt", "w", encoding="utf-8") as f: