feat: 8.2장 스크래핑 샘플 추가
This commit is contained in:
parent
fcb0966a20
commit
02c4d58d8e
24
example/8-2-scrape.py
Normal file
24
example/8-2-scrape.py
Normal file
@ -0,0 +1,24 @@
|
||||
import requests as rq
|
||||
from bs4 import BeautifulSoup
|
||||
import pandas as pd
|
||||
|
||||
url = 'https://kind.krx.co.kr/disclosure/todaydisclosure.do'
|
||||
payload = {
|
||||
'method': 'searchTodayDisclosureSub',
|
||||
'currentPageSize': '15',
|
||||
'pageIndex': '1',
|
||||
'orderMode': '0',
|
||||
'orderStat': 'D',
|
||||
'forward': 'todaydisclosure_sub',
|
||||
'chose': 'S',
|
||||
'todayFlag': 'N',
|
||||
'selDate': '2025-01-24'
|
||||
}
|
||||
|
||||
data = rq.post(url, data=payload)
|
||||
html = BeautifulSoup(data.content, 'html.parser')
|
||||
|
||||
html_unicode = html.prettify()
|
||||
tbl = pd.read_html(html_unicode)
|
||||
|
||||
print(tbl[0].head())
|
||||
Loading…
x
Reference in New Issue
Block a user