Skip to content

Instantly share code, notes, and snippets.

@mr-yoo
Created March 24, 2021 07:04
Show Gist options
  • Save mr-yoo/1dda21a03ed31dcfbe19facc7815d421 to your computer and use it in GitHub Desktop.
Save mr-yoo/1dda21a03ed31dcfbe19facc7815d421 to your computer and use it in GitHub Desktop.
youtube-scrapping-petronet-2
import requests
from bs4 import BeautifulSoup
url = "https://www.petronet.co.kr/v3/jsp/pet/tra/KDXQ1900_l.jsp?term=m&by=2021&bq=1&bm=01&ay=2021&aq=1&am=02&PriceCD=1&ProdCd=B0&Parameter=%3ABusisec%3D%271%27%2C%3APriceCD%3D%271%27%2C%3AFromDate%3D%27202101%27%2C%3AToDate%3D%27202102%27%2C%3AProdCD%3D%27%5C%27B0%5C%27+%27&InitialLoadFile=&ProdCDList=B0&ProdNMList=%C8%D6%B9%DF%C0%AF%2C%B5%EE%C0%AF%2C%B0%E6%C0%AF%2C%B0%E6%C1%FA%C1%DF%C0%AF%2C%C1%DF%C0%AF%2C%B9%E6%C4%ABC%C0%AF%2C%B3%B3%BB%E7%2C%BF%EB%C1%A6%2C%C7%D7%B0%F8%C0%AF%2CLPG%2C%BE%C6%BD%BA%C6%C8%C6%AE%2C%C0%B1%C8%B0%C0%AF%2C%B1%E2%C5%B8+%C1%A6%C7%B0%2C%BA%CE%BB%FD%BF%AC%B7%E1%C0%AF"
resp = requests.post(url)
soup = BeautifulSoup(resp.text, 'html5lib')
result = soup.select("#csvExportTable0 > tbody > tr > td:nth-child(2)")
for item in result:
print(item.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment