Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.08 KB | None | 0 0
  1. CODE OF THE FIRST PAGE
  2. -----------------------------------------------------------------------------
  3. # url of page on usage
  4. my_url = 'URL(DELETED)'
  5.  
  6. # opening up connection, grabbing the page
  7. uClient = uReq(my_url)
  8. page_html = uClient.read()
  9. uClient.close()
  10.  
  11. # html parsing
  12. page_soup = soup(page_html, "html.parser")
  13.  
  14. # grabs each product on the current url
  15. containers = page_soup.findAll("div", {"class": "item__info-container"})
  16.  
  17. # makes a variable with the quantity of apartments on the url
  18. quantity_len = range(len(containers))
  19.  
  20. def print_result():
  21.     for container in quantity_len:
  22.  
  23.         # contiene la dirección del departamento
  24.         address_container = page_soup.findAll("span", {"class": "main-title"})
  25.         address = address_container[container].text
  26.  
  27.  
  28.         print("address: " + address)
  29.  
  30.  
  31. THIS IS WHERE THE NEXT URL IS LOCATED:
  32. ----------------------------------------------------------------------------------------
  33.  next_page_container = page_soup.find("a", {"class": "andes-pagination__link prefetch"})
  34.         next_page = next_page_container["href"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement