Spaces:
Running
Running
File size: 755 Bytes
da7dbd0 22e1b62 da7dbd0 22e1b62 da7dbd0 1ce1659 da7dbd0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
from bs4 import BeautifulSoup
import requests
from src.application.image.search_yandex import get_image_links
img_search_url = """https://yandex.ru/images/search?cbir_id=4481385%2Fw-xYJ246B9thwtVBmNcpkg9409&rpt=imageview&lr=10636"""
print(img_search_url)
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36',
'Content-Type': 'application/json',
}
response = requests.get(img_search_url, headers=headers)
response.raise_for_status() # Raise an exception for bad status codes
# Parse the HTML content
soup = BeautifulSoup(response.content, 'html.parser')
image_urls = get_image_links(soup.prettify())
print(f"image_urls: {image_urls}")
|