Обновить parsers/universal.py
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -22,7 +22,7 @@ def check_url(url: str) -> bool:
|
|||||||
response = wp.check_url_exists(url)
|
response = wp.check_url_exists(url)
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
result = response.json()
|
result = response.json()
|
||||||
print(result["exists"])
|
# print(result["exists"])
|
||||||
return result["exists"]
|
return result["exists"]
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
@@ -49,7 +49,7 @@ class UniversalParser(BaseParser):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
response = requests.get(self.url)
|
response = requests.get(self.url)
|
||||||
print(response.text)
|
# print(response.text)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
except requests.RequestException:
|
except requests.RequestException:
|
||||||
print(f"Ошибка при запросе к {self.url}")
|
print(f"Ошибка при запросе к {self.url}")
|
||||||
@@ -58,7 +58,7 @@ class UniversalParser(BaseParser):
|
|||||||
|
|
||||||
soup = BeautifulSoup(response.text, 'html.parser')
|
soup = BeautifulSoup(response.text, 'html.parser')
|
||||||
base_domain = urlparse(self.url).netloc
|
base_domain = urlparse(self.url).netloc
|
||||||
print(base_domain)
|
# print(base_domain)
|
||||||
|
|
||||||
for a_tag in soup.find_all('a', href=True):
|
for a_tag in soup.find_all('a', href=True):
|
||||||
href = a_tag['href'].strip()
|
href = a_tag['href'].strip()
|
||||||
|
|||||||
Reference in New Issue
Block a user