问题遇到的现象和发生背景
问题相关代码,请勿粘贴截图
- from selenium import webdriver
- from lxml import etree
- user_agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.3 Safari/605.1.15"
- opt = webdriver.FirefoxOptions()
- opt.add_argument('--user-agent=%s' % user_agent)
- driver=webdriver.Firefox(options=opt)
- driver.maximize_window()
- driver.get(url='https://data.eastmoney.com/hsgtcg/gzcglist.html')
- html = etree.HTML(driver.page_source)
- for div in div_list:
- a=div.xpath('.//text()')[1]
- b=div.xpath('.//text()')[2]
- c=div.xpath('.//text()')[3]
- print(a,b,c)
复制代码 运行结果及报错内容鼠标在图片上移动时,方框及其中显示的数字会发生改变,但是Network无反应 我的解答思路和尝试过的方法尝试了requests,selenium等方法,返回值均为空;
似乎找到了一个API接口? - https://datacenter-web.eastmoney.com/api/data/get?callback=jQuery1123013889731581101472_1639308483984&type=RPT_MUTUAL_QUOTA&sty=TRADE_DATE%2CMUTUAL_TYPE%2CBOARD_TYPE%2CMUTUAL_TYPE_NAME%2CFUNDS_DIRECTION%2CINDEX_CODE%2CINDEX_NAME%2CBOARD_CODE&extraCols=status~07~BOARD_CODE%2CdayNetAmtIn~07~BOARD_CODE%2CdayAmtRemain~07~BOARD_CODE%2CdayAmtThreshold~07~BOARD_CODE%2Cf104~07~BOARD_CODE%2Cf105~07~BOARD_CODE%2Cf106~07~BOARD_CODE%2Cf3~03~INDEX_CODE~INDEX_f3%2CnetBuyAmt~07~BOARD_CODE&p=1&ps=200&sr=1&st=MUTUAL_TYPE&source=WEB&client=WEB&_=1639308483986
复制代码但是接口好像只能返回日度数据,并不是表中的分钟级数据 我想要达到的结果导出图中每分钟的时间、深股通(左)、北向(左)
|