Skip to content

Instantly share code, notes, and snippets.

@mr-yoo
Created March 24, 2021 07:05
Show Gist options
  • Save mr-yoo/1b4cfa8991fdd3b5acd40989fe6b96b4 to your computer and use it in GitHub Desktop.
Save mr-yoo/1b4cfa8991fdd3b5acd40989fe6b96b4 to your computer and use it in GitHub Desktop.
youtube-scrapping-petronet-1
import requests
from bs4 import BeautifulSoup
url = "https://www.petronet.co.kr/v3/jsp/pet/tra/KDXQ1900_l.jsp"
data = {
"term": "m",
"by": "2021",
"bq": "1",
"bm": "01",
"ay": "2021",
"aq": "1",
"am": "02",
"priceCD": "1",
"ProdCd": "B0",
"Parameter": ":Busisec='1',:PriceCD='1',:FromDate='202101',:ToDate='202102',:ProdCD='\'B0\'+'",
"ProdCDList": "B0"
}
resp = requests.post(url, json=data)
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