Automating Nighttime Web Scraping: Scheduling Code Execution and Data Retrieval Every 3 Minutes

I am attempting to control the code below by starting it from local time 9:30 PM to 4:00 AM. Additionally, I would like to run the web scraping process every 3 minutes. Could you please provide guidance on how to code this? If you have any ideas, please let me know.

{
“Name”: “Stock Price Capture”,
“CreationDate”: “2024-3-18”,
“Commands”: [
{
“Command”: “open”,
“Target”: “Tesla, Inc. (TSLA) 股價、新聞、報價和過往記錄 - Yahoo 財經”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “Price”,
“Value”: “!csvLine”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “Volume”,
“Value”: “!csvLine”,
“Description”: “”
},
{
“Command”: “csvSave”,
“Target”: “TeslaPrice”,
“Value”: “!csvLine”,
“Description”: “”
},
{
“Command”: “storeText”,
“Target”: “xpath=//[@id="quote-header-info"]/div[3]/div/div/fin-streamer",
“Value”: “!csvLine”,
“Description”: “”
},
{
“Command”: “storeText”,
“Target”: "xpath=//
[@id="quote-summary"]/div/table/tbody/tr[7]/td[2]”,
“Value”: “!csvLine”,
“Description”: “”
},
{
“Command”: “csvSave”,
“Target”: “TeslaPrice”,
“Value”: “!csvLine”,
“Description”: “”
},
{
“Command”: “”,
“Target”: “”,
“Value”: “”,
“Description”: “”
}
]
}

1 Like

See How-to: Windows Task Scheduler, Automate RPA tasks

2 Likes

Thank you for that, it is a good start. However, I would like to know if there is any control for the code to run every 3 minutes. Is that using a loop to manage it? I want to make it run every 3 minutes so that it would have multiple records in the same file.