try :
import pandas as pd
import requests
from bs4 import BeautifulSoup
headers = {
"Referer": "http://www.nasdaqtrader.com/Trader.aspx?id=archiveheadlines&cat_id=105"
}
data = {
"id": 2,
"method": "BL_NewsListing.GetArchiveHeadlinesPageData",
"params": "[\"105\",2023,0]",
"version": "1.1"
}
url = "https://www.nasdaqtrader.com/RPCHandler.axd"
req = requests.post(url, json=data, headers=headers)
result = req.json()["result"]
soup = BeautifulSoup(result, "html.parser")
table = soup.find("table")
df = pd.read_html(str(table))[0]
print(df)
打印:
Date Market Alert # Headline
0 Mar 31, 2023 NASDAQ #2023-196 Information regarding the redemption of TCV Acquisition Corp. (TCVA)
1 Mar 31, 2023 NASDAQ #2023-195 Information Regarding the Reverse Stock Split and CUSIP Number Change for China Natural Resources, Inc. (CHNR)
2 Mar 30, 2023 NASDAQ #2023-194 Information Regarding the Business Combination of DiamondHead Holdings Corp. (DHHC/W/U) and Great Southern Homes, Inc. (Re-named United Homes Group, Inc.)
3 Mar 30, 2023 NASDAQ #2023-193 Information Regarding the Reverse Stock Split, Name, Symbol & CUSIP Number Change for Helbiz, Inc. (HLBZ/HLBZW)
4 Mar 30, 2023 NASDAQ #2023-192 Information Regarding the Reverse Stock Split and CUSIP Number Change for Ensysce Biosciences, Inc. (ENSC)
5 Mar 29, 2023 NASDAQ #2023-191 Information regarding the redemption of Aries I Acquisition Corporation (RAM/RAMMU/RAMMW)
6 Mar 29, 2023 NASDAQ #2023-190 Information Regarding the Business Combination of Maxpro Capital Acquisition Corp. (JMAC/W/U) & Apollomics Inc.
7 Mar 29, 2023 NASDAQ #2023-189 Information Regarding the Reverse Stock Split , Ratio and CUSIP Number Changes for Biophytis S.A. (BPTS)
8 Mar 28, 2023 NASDAQ #2023-188 (UPDATED: Merger Effective) Information Regarding the Merger of AgroFresh Solutions, Inc. (AGFS)
...