Skip to content

Instantly share code, notes, and snippets.

@osori osori/phyundai.py
Last active Nov 24, 2017

Embed
What would you like to do?
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
You can’t perform that action at this time.