Skip to content

Instantly share code, notes, and snippets.

@osori
Last active November 24, 2017 05:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save osori/f8b6a0e5339606f4f3795861eaad1572 to your computer and use it in GitHub Desktop.
Save osori/f8b6a0e5339606f4f3795861eaad1572 to your computer and use it in GitHub Desktop.
pangyo-hyundai
# Jupyter Notebook에서 실행하세요
from IPython.display import Image, display
from bs4 import BeautifulSoup
import requests
print("어서오세요 품격과 전통의 판교 현백입니다.\n 어떤 물건을 찾으세요?")
query = input() # 유저 인풋 받아오기
response = requests.get("http://www.thehyundai.com/front/dpo/hdSearch.thd?searchtype=&" +
"searchQuery=" + query)
soup = BeautifulSoup(response.text, 'html.parser')
products = soup.select('#product-list li .prod-unit')
for idx, product in enumerate(products):
img_url = product.find('img')['src']
price = product.find('div', class_='price-info').text.strip().splitlines()[0]
name = product.find('a', class_='title ellipsis').text
print(f'{idx}. {name}')
display(Image(url=img_url))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment