Fnguide 증권사별 적정주가 & 투자의견 크롤링

https://comp.fnguide.com/SVO2/json/data/01_06/03_A005930.json 을 크롤링하는 예제

import requests

class Fnguide():
  def __init__(self, parent=None):
    super().__init__()

  def crawlingConsensus(self):
    sCode = sCode = 'A005930' # 삼성전자
    json_url = 'https://comp.fnguide.com/SVO2/json/data/01_06/03_' + sCode + '.json'
    r = requests.get(json_url)
    r.encoding = 'utf-8-sig'
    result = r.json()
    if len(result['comp']) > 0:
      for r in result['comp']:
        print('==============')
        print(r)

if __name__ == "__main__":
  fnguide = Fnguide()
  fnguide.crawlingConsensus()

결과

{'INST_CD': '63', 'INST_NM': 'IBK투자증권', 'EST_DT': '2023/03/31', 'TARGET_PRC': '80,000', 'TARGET_PRC_BF': '70,000', 'YOY': '14.29', 'RECOM_CD': '4.00', 'RECOM_CD_BF': '4.00', 'AVG_PRC': '79,227', 'AVG_PRC_BF': '77,455', 'AVG_RECOM_CD': '4.00', 'AVG_RECOM_CD_BF': '4.00'}

{'INST_CD': '25', 'INST_NM': 'SK증권', 'EST_DT': '2023/03/30', 'TARGET_PRC': '80,000', 'TARGET_PRC_BF': '75,000', 'YOY': '6.67', 'RECOM_CD': '4.00', 'RECOM_CD_BF': '4.00', 'AVG_PRC': '79,227', 'AVG_PRC_BF': '77,455', 'AVG_RECOM_CD': '4.00', 'AVG_RECOM_CD_BF': '4.00'}

{'INST_CD': '12', 'INST_NM': 'NH투자증권', 'EST_DT': '2023/03/30', 'TARGET_PRC': '79,000', 'TARGET_PRC_BF': '72,000', 'YOY': '9.72', 'RECOM_CD': '4.00', 'RECOM_CD_BF': '4.00', 'AVG_PRC': '79,227', 'AVG_PRC_BF': '77,455', 'AVG_RECOM_CD': '4.00', 'AVG_RECOM_CD_BF': '4.00'}

{'INST_CD': '50', 'INST_NM': '키움증권', 'EST_DT': '2023/03/29', 'TARGET_PRC': '78,000', 'TARGET_PRC_BF': '73,000', 'YOY': '6.85', 'RECOM_CD': '4.00', 'RECOM_CD_BF': '4.00', 'AVG_PRC': '79,227', 'AVG_PRC_BF': '77,455', 'AVG_RECOM_CD': '4.00', 'AVG_RECOM_CD_BF': '4.00'}
평점을 남겨주세요
평점 : 5.0
총 투표수 : 1