мне нужно собрать ссылка на изображения с сайта olx
код написан и работает вроде как исправно но есть одно но
вот код
import requests
from bs4 import BeautifulSoup
import lxml
import os
from time import sleep
url = "https://www.olx.kz/elektronika/telefony-i-aksesuary/"
headers = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/117.0.0.0 Safari/537.36'}
r = requests.get(url, allow_redirects=True)
def img_parse():
if r.status_code == 200:
html = r.text
soup = BeautifulSoup(html, features='lxml')
if not os.path.exists('images'):
os.makedirs('images')
div_tags = soup.find_all('div')
for div_tag in div_tags:
img_tags = div_tag.find_all('img')
for img_tag in img_tags:
img_url = img_tag.get('src')
print(img_url)
if __name__ == '__main__':
img_parse()
ссылки то он собирает но не все , когда перехожу сам на страницу фотографий больше чем ссылок
Вот пример что выдает консоль
https://frankfurt.apollo.olxcdn.com:443/v1/files/47uqtgs2n95q1-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/47uqtgs2n95q1-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/47uqtgs2n95q1-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/47uqtgs2n95q1-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/47uqtgs2n95q1-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/47uqtgs2n95q1-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/o5mmh6ww57my1-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/o5mmh6ww57my1-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/o5mmh6ww57my1-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/o5mmh6ww57my1-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/o5mmh6ww57my1-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/o5mmh6ww57my1-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/lds5krgnid542-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/lds5krgnid542-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/lds5krgnid542-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/lds5krgnid542-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/lds5krgnid542-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/lds5krgnid542-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/ezzc3fvkj75k2-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/ezzc3fvkj75k2-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/ezzc3fvkj75k2-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/ezzc3fvkj75k2-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/ezzc3fvkj75k2-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/ezzc3fvkj75k2-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/qzgbcx7dmjbi2-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/qzgbcx7dmjbi2-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/qzgbcx7dmjbi2-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/qzgbcx7dmjbi2-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/qzgbcx7dmjbi2-KZ/image;s=200x0;q=50
https://frankfurt.apollo.olxcdn.com:443/v1/files/qzgbcx7dmjbi2-KZ/image;s=200x0;q=50
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
/app/static/media/no_thumbnail.15f456ec5.svg
не могу понять в чем дело