akfamily / aktools

AKTools is an elegant and simple HTTP API library for AKShare, built for AKSharers!
https://aktools.akfamily.xyz/
MIT License
533 stars 108 forks source link

使用淘股吧股票热度接口时候报错 #143

Closed ZeroToBillions closed 12 months ago

ZeroToBillions commented 12 months ago

我在测试淘股吧的股票热度的时候,应用接口报错,请问这是什么情况呀? 我看用户手册里面也没说要输入参数?

以下是使用的报错情况

股票热度-淘股吧 接口: stock_hot_tgb

目标地址: https://www.taoguba.com.cn/stock/moreHotStock

描述: 淘股吧-热门股票

限量: 单次返回排名前 20 股票

输入参数

名称 类型 描述


输出参数

名称 类型 描述 个股代码 object - 个股名称 object - 接口示例

import akshare as ak

stock_hot_tgb_df = ak.stock_hot_tgb()
print(stock_hot_tgb_df)

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
[c:\Users\Frank\Synology\0Programing\AutoDailyReport.ipynb](file:///C:/Users/Frank/Synology/0Programing/AutoDailyReport.ipynb) 单元格 15 line 2
      [1](vscode-notebook-cell:/c%3A/Users/Frank/Synology/0Programing/AutoDailyReport.ipynb#X24sZmlsZQ%3D%3D?line=0) # 股票热度-淘股吧
      [2](vscode-notebook-cell:/c%3A/Users/Frank/Synology/0Programing/AutoDailyReport.ipynb#X24sZmlsZQ%3D%3D?line=1) # 接口: stock_hot_tgb
      [3](vscode-notebook-cell:/c%3A/Users/Frank/Synology/0Programing/AutoDailyReport.ipynb#X24sZmlsZQ%3D%3D?line=2) 
   (...)
     [20](vscode-notebook-cell:/c%3A/Users/Frank/Synology/0Programing/AutoDailyReport.ipynb#X24sZmlsZQ%3D%3D?line=19) 
     [21](vscode-notebook-cell:/c%3A/Users/Frank/Synology/0Programing/AutoDailyReport.ipynb#X24sZmlsZQ%3D%3D?line=20) # import akshare as ak
---> [23](vscode-notebook-cell:/c%3A/Users/Frank/Synology/0Programing/AutoDailyReport.ipynb#X24sZmlsZQ%3D%3D?line=22) stock_hot_tgb_df = ak.stock_hot_tgb()
     [24](vscode-notebook-cell:/c%3A/Users/Frank/Synology/0Programing/AutoDailyReport.ipynb#X24sZmlsZQ%3D%3D?line=23) print(stock_hot_tgb_df)
     [25](vscode-notebook-cell:/c%3A/Users/Frank/Synology/0Programing/AutoDailyReport.ipynb#X24sZmlsZQ%3D%3D?line=24) # 数据示例
     [26](vscode-notebook-cell:/c%3A/Users/Frank/Synology/0Programing/AutoDailyReport.ipynb#X24sZmlsZQ%3D%3D?line=25) 
     [27](vscode-notebook-cell:/c%3A/Users/Frank/Synology/0Programing/AutoDailyReport.ipynb#X24sZmlsZQ%3D%3D?line=26) #         个股代码  个股名称
   (...)
     [46](vscode-notebook-cell:/c%3A/Users/Frank/Synology/0Programing/AutoDailyReport.ipynb#X24sZmlsZQ%3D%3D?line=45) # 18  sz002264   新华都
     [47](vscode-notebook-cell:/c%3A/Users/Frank/Synology/0Programing/AutoDailyReport.ipynb#X24sZmlsZQ%3D%3D?line=46) # 19  sz301088  戎美股份

File [c:\Users\Frank\AppData\Local\Programs\Python\Python311\Lib\site-packages\akshare\stock_feature\stock_hot_tgb.py:21](file:///C:/Users/Frank/AppData/Local/Programs/Python/Python311/Lib/site-packages/akshare/stock_feature/stock_hot_tgb.py:21), in stock_hot_tgb()
     [19](file:///C:/Users/Frank/AppData/Local/Programs/Python/Python311/Lib/site-packages/akshare/stock_feature/stock_hot_tgb.py:19) url = "https://www.taoguba.com.cn/stock/moreHotStock"
     [20](file:///C:/Users/Frank/AppData/Local/Programs/Python/Python311/Lib/site-packages/akshare/stock_feature/stock_hot_tgb.py:20) r = requests.get(url)
---> [21](file:///C:/Users/Frank/AppData/Local/Programs/Python/Python311/Lib/site-packages/akshare/stock_feature/stock_hot_tgb.py:21) temp_df = pd.concat([pd.read_html(r.text, header=0)[0], pd.read_html(r.text, header=0)[1]])
     [22](file:///C:/Users/Frank/AppData/Local/Programs/Python/Python311/Lib/site-packages/akshare/stock_feature/stock_hot_tgb.py:22) temp_df = temp_df[[
     [23](file:///C:/Users/Frank/AppData/Local/Programs/Python/Python311/Lib/site-packages/akshare/stock_feature/stock_hot_tgb.py:23)     "个股代码",
     [24](file:///C:/Users/Frank/AppData/Local/Programs/Python/Python311/Lib/site-packages/akshare/stock_feature/stock_hot_tgb.py:24)     "个股名称",
     [25](file:///C:/Users/Frank/AppData/Local/Programs/Python/Python311/Lib/site-packages/akshare/stock_feature/stock_hot_tgb.py:25) ]]
     [26](file:///C:/Users/Frank/AppData/Local/Programs/Python/Python311/Lib/site-packages/akshare/stock_feature/stock_hot_tgb.py:26) temp_df.reset_index(inplace=True, drop=True)

IndexError: list index out of range
albertandking commented 12 months ago

我在测试淘股吧的股票热度的时候,应用接口报错,请问这是什么情况呀? 我看用户手册里面也没说要输入参数?

以下是使用的报错情况

股票热度-淘股吧 接口: stock_hot_tgb

目标地址: https://www.taoguba.com.cn/stock/moreHotStock

描述: 淘股吧-热门股票

限量: 单次返回排名前 20 股票

输入参数

名称 类型 描述

输出参数

名称 类型 描述 个股代码 object - 个股名称 object - 接口示例

import akshare as ak

stock_hot_tgb_df = ak.stock_hot_tgb()
print(stock_hot_tgb_df)

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
[c:\Users\Frank\Synology\0Programing\AutoDailyReport.ipynb](file:///C:/Users/Frank/Synology/0Programing/AutoDailyReport.ipynb) 单元格 15 line 2
      [1](vscode-notebook-cell:/c%3A/Users/Frank/Synology/0Programing/AutoDailyReport.ipynb#X24sZmlsZQ%3D%3D?line=0) # 股票热度-淘股吧
      [2](vscode-notebook-cell:/c%3A/Users/Frank/Synology/0Programing/AutoDailyReport.ipynb#X24sZmlsZQ%3D%3D?line=1) # 接口: stock_hot_tgb
      [3](vscode-notebook-cell:/c%3A/Users/Frank/Synology/0Programing/AutoDailyReport.ipynb#X24sZmlsZQ%3D%3D?line=2) 
   (...)
     [20](vscode-notebook-cell:/c%3A/Users/Frank/Synology/0Programing/AutoDailyReport.ipynb#X24sZmlsZQ%3D%3D?line=19) 
     [21](vscode-notebook-cell:/c%3A/Users/Frank/Synology/0Programing/AutoDailyReport.ipynb#X24sZmlsZQ%3D%3D?line=20) # import akshare as ak
---> [23](vscode-notebook-cell:/c%3A/Users/Frank/Synology/0Programing/AutoDailyReport.ipynb#X24sZmlsZQ%3D%3D?line=22) stock_hot_tgb_df = ak.stock_hot_tgb()
     [24](vscode-notebook-cell:/c%3A/Users/Frank/Synology/0Programing/AutoDailyReport.ipynb#X24sZmlsZQ%3D%3D?line=23) print(stock_hot_tgb_df)
     [25](vscode-notebook-cell:/c%3A/Users/Frank/Synology/0Programing/AutoDailyReport.ipynb#X24sZmlsZQ%3D%3D?line=24) # 数据示例
     [26](vscode-notebook-cell:/c%3A/Users/Frank/Synology/0Programing/AutoDailyReport.ipynb#X24sZmlsZQ%3D%3D?line=25) 
     [27](vscode-notebook-cell:/c%3A/Users/Frank/Synology/0Programing/AutoDailyReport.ipynb#X24sZmlsZQ%3D%3D?line=26) #         个股代码  个股名称
   (...)
     [46](vscode-notebook-cell:/c%3A/Users/Frank/Synology/0Programing/AutoDailyReport.ipynb#X24sZmlsZQ%3D%3D?line=45) # 18  sz002264   新华都
     [47](vscode-notebook-cell:/c%3A/Users/Frank/Synology/0Programing/AutoDailyReport.ipynb#X24sZmlsZQ%3D%3D?line=46) # 19  sz301088  戎美股份

File [c:\Users\Frank\AppData\Local\Programs\Python\Python311\Lib\site-packages\akshare\stock_feature\stock_hot_tgb.py:21](file:///C:/Users/Frank/AppData/Local/Programs/Python/Python311/Lib/site-packages/akshare/stock_feature/stock_hot_tgb.py:21), in stock_hot_tgb()
     [19](file:///C:/Users/Frank/AppData/Local/Programs/Python/Python311/Lib/site-packages/akshare/stock_feature/stock_hot_tgb.py:19) url = "https://www.taoguba.com.cn/stock/moreHotStock"
     [20](file:///C:/Users/Frank/AppData/Local/Programs/Python/Python311/Lib/site-packages/akshare/stock_feature/stock_hot_tgb.py:20) r = requests.get(url)
---> [21](file:///C:/Users/Frank/AppData/Local/Programs/Python/Python311/Lib/site-packages/akshare/stock_feature/stock_hot_tgb.py:21) temp_df = pd.concat([pd.read_html(r.text, header=0)[0], pd.read_html(r.text, header=0)[1]])
     [22](file:///C:/Users/Frank/AppData/Local/Programs/Python/Python311/Lib/site-packages/akshare/stock_feature/stock_hot_tgb.py:22) temp_df = temp_df[[
     [23](file:///C:/Users/Frank/AppData/Local/Programs/Python/Python311/Lib/site-packages/akshare/stock_feature/stock_hot_tgb.py:23)     "个股代码",
     [24](file:///C:/Users/Frank/AppData/Local/Programs/Python/Python311/Lib/site-packages/akshare/stock_feature/stock_hot_tgb.py:24)     "个股名称",
     [25](file:///C:/Users/Frank/AppData/Local/Programs/Python/Python311/Lib/site-packages/akshare/stock_feature/stock_hot_tgb.py:25) ]]
     [26](file:///C:/Users/Frank/AppData/Local/Programs/Python/Python311/Lib/site-packages/akshare/stock_feature/stock_hot_tgb.py:26) temp_df.reset_index(inplace=True, drop=True)

IndexError: list index out of range

由于数据源没有数据,已经移除该接口