안녕하세요. josw123님 파이썬 초보여서 어쭙고싶습니다. #194
Replies: 1 comment 1 reply
-
안녕하세요. 아래 코드와 같이 사용하시면 되며 import dart_fss as dart
import re
from tqdm.auto import tqdm
# '정관' 키워드에 대한 정규표현식 패턴 생성
pattern_statutes = dart.utils.query_to_regex(r'정관')
# 전체 상장기업 목록 가져오기
corporation_list = dart.get_corp_list()
# 'YK' 마켓(코스닥) 기업만 필터링
yk_corporations = corporation_list.find_by_corp_name('', market='YK')
# 기업별 정관 저장용 딕셔너리
statutes_by_corp = {}
# 최대 50개 기업에 대해 순차 처리
for corporation in tqdm(yk_corporations, desc="기업 처리 진행"):
try:
# 2023년 1월 1일 이후 A001(사업보고서) 공시 검색
filings = corporation.search_filings(
bgn_de='20230101',
pblntf_detail_ty='A001'
)
if not filings:
continue
latest_filing = filings[0]
# 첨부문서 중 '정관' 이름을 가진 보고서 찾기
for attachment in latest_filing.attached_reports:
if pattern_statutes.search(attachment.rpt_nm):
# 문서 내용 중 '정 관' 섹션 추출
matched_sections = attachment.find_all(includes=r'정\s+관')
if matched_sections:
statutes_by_corp[corporation.corp_code] = matched_sections[0]
break # 하나만 저장하고 다음 기업으로
except dart.errors.NoDataReceived:
print(f"데이터 수신 실패: {corporation.corp_name} ({corporation.corp_code})") 상세 셜명은 아래와 같습니다.
이렇게 모아둔 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
안녕하세요. 파이썬 초보여서 여쭙고싶은게 있습니다.
전자공시시스템에서 상장회사(코스피,코스닥)들의 정관을 일괄적으로 받고싶은데,
이럴때 어떤식의 스크립트를 짜야할까요?..
아무리 시도해봐도 안돼서 고수님께 여쭙습니다..
바쁘시겠지만 부탁드립니다 ㅠㅠ
Beta Was this translation helpful? Give feedback.
All reactions