# 选择的是爬虫对象是一个叫天天基金的boy,爬虫的目标是获得基金的净值数据
import requests
import pandas as pd
import re
import json
import math
import time
import random
# 分析网站 某一基金历史净值下的网页
# 003096下第二页的网址
# 请求 URL: http://api.fund.eastmoney.com/f10/lsjz?callback=jQuery18306109215334887248_1650275960949&fundCode=003096&pageIndex=2&pageSize=20&startDate=&endDate=&_=1650275974990
# 第三页
# 请求 URL: http://api.fund.eastmoney.com/f10/lsjz?callback=jQuery18306109215334887248_1650275960949&fundCode=003096&pageIndex=3&pageSize=20&startDate=&endDate=&_=1650276020380
# 分析得知pageIndex=2,pageIndex=3 有区别,其余都一样
# 获取所有基金代码
def get_fundcode():
'''
获取fundcode列表
:return: 将获取的DataFrame以csv格式存入本地
'''
url = 'http://fund.eastmoney.com/js/fundcode_search.js'
r = requests.get(url)
cont = re.findall('var r
基金净值(某几个基金净值)
最新推荐文章于 2024-07-30 21:09:58 发布