· 3 years ago · Sep 20, 2022, 05:10 PM
1Function New-SMSnotification($text) {
2 $params = @{
3 "user"="ssssssss"; #user ID
4 "pass"="ssssssss"; #API Key
5 "msg"=$text;
6 }
7
8 Invoke-WebRequest -Uri https://smsapi.free-mobile.fr/sendmsg -Method POST -Body ($params|ConvertTo-Json) -ContentType "application/json" | Out-Null
9}
10
11$WebResponse = Invoke-WebRequest "https://www.cashexpress.fr/produits-occasions/jeu-nintendo,61/magasin-cannes-mandelieu,233.html?marques[]=8511&tri=dt_rec-desc"
12$ScrappedTitles = $WebResponse.ParsedHtml.body.getElementsByTagName('a') | Where-Object {$_.href -like '*jeu-switch*'} | Select-Object -ExpandProperty nameProp
13
14$Titles = ""
15$LastEntry = ""
16$firstEntry = $true
17$ScrappedTitles | % {
18 If ($_ -ne $LastEntry -And -Not $firstEntry) {
19 $Titles += "`n" + $($_.substring(11, $_.Length -33)).replace('-',' ')
20 }
21 Elseif ($_ -ne $LastEntry -And $firstEntry) {
22 $Titles += $($_.substring(11, $_.Length -33)).replace('-',' ')
23 $firstEntry = $false
24 }
25 $LastEntry = $_
26}
27
28If($Titles -like "*pokemon*" -Or $Titles -like "*pokémon*") {
29 New-SMSnotification "Pokemon game available at cashexpress Mandelieu."
30}
31