(session, url, semaphore)
| 679 | return modified_urls |
| 680 | |
| 681 | async def is_url_accessible(session, url, semaphore): |
| 682 | async with semaphore: |
| 683 | try: |
| 684 | async with session.get(url, timeout=0.5) as response: |
| 685 | if response.status == 200: |
| 686 | current_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") |
| 687 | print(f"{current_time} {url}") |
| 688 | return url |
| 689 | except (aiohttp.ClientError, asyncio.TimeoutError): |
| 690 | pass |
| 691 | return None |
| 692 | |
| 693 | async def check_urls(session, urls, semaphore): |
| 694 | tasks = [] |