0

I have some problem with parsing links for images (images of house) on this site (https://kvartiry-bolgarii.ru/trekhkomnatnaya-kvartira-v-blagoustroennom-i-spokoynom-kurortnom-poselke-o26252)

How can i get full link? How can I get data from src (in all images) and combine it into full link with site domain?

Im try it but cant get full link because dont kbow how to take link in src

import requests
from bs4 import BeautifulSoup

rs = requests.get('https://kvartiry-bolgarii.ru/neveroyatnaya-kvartira-s-vidom-na-more-tip-pentkhaus-o26253')
root = BeautifulSoup(rs.content, 'html.parser')

urls = root.select('#slider > li > img[src]')
print(urls)
# [<img alt="" src="/photos/5e2c79b4-7da2-478e-a783-ad8f010d0b15.jpg"/>, , <img alt="" src="/photos/90f58624-1f32-46a2-afc9-ad8f010e2703.jpg"/>]
3
  • Do you want the image URLs shown in slider? Can you use beautifulsoup? Commented Aug 30, 2021 at 17:50
  • 1
    Show what you already tried. Commented Aug 30, 2021 at 17:54
  • Let me know if you are looking for solution using Selenium ? Commented Aug 30, 2021 at 18:23

1 Answer 1

1

I don't understand how you could get that far and not know how to get the src attribute:

import requests
from bs4 import BeautifulSoup

base = 'https://kvartiry-bolgarii.ru/neveroyatnaya-kvartira-s-vidom-na-more-tip-pentkhaus-o26253'

rs = requests.get(base)
root = BeautifulSoup(rs.content, 'html.parser')

urls = root.select('#slider > li > img[src]')
for url in urls:
    print( base+url['src'] )
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.