fix: update pkgs
This commit is contained in:
parent
5b43b64401
commit
06f8627331
3 changed files with 1240 additions and 906 deletions
|
|
@ -71,7 +71,7 @@ def _retry_after_requests(details):
|
|||
on_backoff=_retry_after_requests,
|
||||
)
|
||||
def _fetch(url: str) -> str:
|
||||
r = _session.get(url, headers=HEADERS, timeout=TIMEOUT_SECONDS, verify=False)
|
||||
r = _session.get(url, headers=HEADERS, timeout=TIMEOUT_SECONDS)
|
||||
if r.status_code in RETRY_STATUS:
|
||||
raise requests.HTTPError(response=r)
|
||||
r.raise_for_status()
|
||||
|
|
@ -244,7 +244,6 @@ def _to_problem_summaries(rows: list[dict[str, str]]) -> list[ProblemSummary]:
|
|||
async def _fetch_all_contests_async() -> list[ContestSummary]:
|
||||
async with httpx.AsyncClient(
|
||||
limits=httpx.Limits(max_connections=100, max_keepalive_connections=100),
|
||||
verify=False,
|
||||
) as client:
|
||||
first_html = await _get_async(client, ARCHIVE_URL)
|
||||
last = _parse_last_page(first_html)
|
||||
|
|
|
|||
18
script.py
Normal file
18
script.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env python3
|
||||
from bs4 import BeautifulSoup
|
||||
from scrapling.fetchers import StealthyFetcher
|
||||
|
||||
URL = "https://codeforces.com/contest/1974/problem/A"
|
||||
|
||||
page = StealthyFetcher.fetch(
|
||||
URL,
|
||||
headless=True,
|
||||
solve_cloudflare=True,
|
||||
)
|
||||
|
||||
soup = BeautifulSoup(page.html_content, "html.parser")
|
||||
title = soup.find("div", class_="title")
|
||||
if title:
|
||||
print("Page fetched successfully. Problem title:", title.get_text(strip=True))
|
||||
else:
|
||||
print("Page fetched but could not find problem title.")
|
||||
Loading…
Add table
Add a link
Reference in a new issue