Skip to content

Instantly share code, notes, and snippets.

@dimiboy
Last active April 17, 2024 17:50
Show Gist options
  • Save dimiboy/4bf727f230fbd70e3fdb060461241e4a to your computer and use it in GitHub Desktop.
Save dimiboy/4bf727f230fbd70e3fdb060461241e4a to your computer and use it in GitHub Desktop.
$ShareLinks = @(
@{Link='https://www.google.com/finance/quote/INTC:NASDAQ';Price='52'}
)
$body = $null
$Summarybody = $null
foreach($share in $shareLinks){
$WebResponse = Invoke-WebRequest $Share.link
$WebResponse.Content -match ('<div class="YMlKec fxKbKc">.*</div>') |out-null
$SharePrice = $Matches.values.trim('<div class="YMlKec fxKbKc">').split('</div>')[0]
$WebResponse.Content -match ('</script><title>.* ') |out-null
$shareName = $Matches.values.split('>').split('(')[2]
$intprice = [decimal]$SharePrice.Split('$')[1]
$shareShow = "$" + $share.price
$Summarybody = $Summarybody + "`n" + "$shareName share price is currently $SharePrice"
if($intprice -lt $share.price ){
$b = "$shareName share price is currently $SharePrice which is below $shareShow that you asked"
$body = $body + "`n" + $b
}
}
# Notification:
if($body -ne $null){
C:\SCRIPTS\notificator.ps1 -telegram -subject "Price Drop Alert!" -body $body
}else {
C:\SCRIPTS\notificator.ps1 -mail -subject "Current Price Summary:" -body $Summarybody
}
@asafravid
Copy link

Nice
Can you add an option to get the other parameters such as Price to Earnings, etc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment