测试积点老人 发表于 2021-12-15 13:15:41

python动态页面爬虫/东方财富北向资金

问题遇到的现象和发生背景

问题相关代码,请勿粘贴截图
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()')
    b=div.xpath('.//text()')
    c=div.xpath('.//text()')
    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但是接口好像只能返回日度数据,并不是表中的分钟级数据我想要达到的结果导出图中每分钟的时间、深股通(左)、北向(左)

qqq911 发表于 2021-12-16 11:05:53

这个是动态的吧,需要每次获取

jingzizx 发表于 2021-12-16 15:41:10

需要时时更新的,应该字段不会动
页: [1]
查看完整版本: python动态页面爬虫/东方财富北向资金