📦 Initialize Geulbeot structure and merge Prompts & test projects
This commit is contained in:
14
02. Prompts/문서생성/codedomain/카테고리_내용_Python_v01.py
Normal file
14
02. Prompts/문서생성/codedomain/카테고리_내용_Python_v01.py
Normal file
@@ -0,0 +1,14 @@
|
||||
def get_category_and_content(detail_url):
|
||||
res = requests.get(detail_url)
|
||||
soup = BeautifulSoup(res.text, 'html.parser')
|
||||
|
||||
# 카테고리
|
||||
category_tags = soup.select('ul.flex.flex-row.flex-wrap.gap-2 li a')
|
||||
categories = [tag['href'].split('/')[-2] for tag in category_tags]
|
||||
|
||||
# 내용
|
||||
content_div = soup.select_one('div.content-base.workflow-description.text-md')
|
||||
if content_div:
|
||||
content_text = content_div.get_text(separator=' ', strip=True)
|
||||
else:
|
||||
content_text =
|
||||
Reference in New Issue
Block a user