从网站 table 中提取数据
Extracting data from website's table
我想每 10 分钟从网站 table 自动提取数据并将其保存为 .csv 格式。
我最初的想法是使用 "iMacro for Chrome" 扩展名来检索数据,但是 Windows Task Scheduler 无法自动打开 Chrome 和 运行 .iim 宏。
我的下一个想法是使用 PowerShell 的 Invoke-WebRequest 来检索数据,但它只能获取其中的一部分。
(Invoke-WebRequest "<url>").content
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge, chrome=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<SCRIPT language="JavaScript">top.location = '/index.php?PHPSESSID=1ocektpk6itt46r08lq7epln32&internalurltime=1511187487&logout=1'</SCRIPT></body></html>
登录使用 SSO。
所以,我的问题是:还有没有其他方法可以每 10 分钟自动检索一次数据,而无需安装第 3 方软件?
谢谢!
您也可以试试这些:
Invoke-RESTMethod -URI "http://www.example.com" -Method Get
$webClient = [System.Net.Webclient]::new()
$webClient.DownloadString() 或 .DownloadFile() 取决于您的需求
我想每 10 分钟从网站 table 自动提取数据并将其保存为 .csv 格式。
我最初的想法是使用 "iMacro for Chrome" 扩展名来检索数据,但是 Windows Task Scheduler 无法自动打开 Chrome 和 运行 .iim 宏。
我的下一个想法是使用 PowerShell 的 Invoke-WebRequest 来检索数据,但它只能获取其中的一部分。
(Invoke-WebRequest "<url>").content
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge, chrome=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<SCRIPT language="JavaScript">top.location = '/index.php?PHPSESSID=1ocektpk6itt46r08lq7epln32&internalurltime=1511187487&logout=1'</SCRIPT></body></html>
登录使用 SSO。
所以,我的问题是:还有没有其他方法可以每 10 分钟自动检索一次数据,而无需安装第 3 方软件?
谢谢!
您也可以试试这些:
Invoke-RESTMethod -URI "http://www.example.com" -Method Get
$webClient = [System.Net.Webclient]::new() $webClient.DownloadString() 或 .DownloadFile() 取决于您的需求