Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <array.au3>
- #include <Inet.au3>
- #include <GUIConstantsEx.au3>
- #include <MsgBoxConstants.au3>
- #include <WindowsConstants.au3>
- $start = "https://store.playstation.com"
- $siteBase = "https://store.playstation.com/de-de/grid/STORE-MSF75508-PLAYSTATIONVRHUB/"
- ;~ local $listAllGames[1][6] = [["Name", "Prozente" ,"Alter Preis", "Neuer Preis", "Link", "Seite"]]
- GUICreate("Playstation VR Angebots-Finder", 620, 520, 100, 200)
- GUISetBkColor(0x00E0FFFF) ; will change background color
- Local $idListview = GUICtrlCreateListView("Name |Prozente|Alter Preis|Neuer Preis|Link|Seite", 10, 10, 600, 410) ;,$LVS_SORTDESCENDING)
- Local $idButton = GUICtrlCreateButton("Link öffnen?", 10, 450, 600, 20)
- $end = False
- $v = 1
- Do
- local $source = replaceHTMLEscapes(_INetGetSource($siteBase & $v))
- local $found = StringRegExp($source, '(?U)<span class="discount-badge__message">(.*)</span>(?s).*(?-s)<a href="(.*)" id="(?s).*(?-s)<span title="(.*)">(?s).*(?-s)shared-presentation__price-display__900cc--grid ember-view">(?s)(.*)(?-s)</a> </span>', 3)
- For $i = 0 To UBound($found)-1 Step 4
- local $foundPrice = StringRegExp($found[$i + 3], '<div class="price">(.*)</div>(?s).*(?-s)<h3 class="price-display__price">(.*)</h3>', 3)
- local $old = ""
- local $new = ""
- If IsArray($foundPrice) Then
- $old = $foundPrice[0]
- $new = $foundPrice[1]
- Else
- $foundPrice = StringRegExp($found[$i + 3], '<h3 class="price-display.*>(.*)</h3>', 3)
- $old = ""
- $new = $foundPrice[0]
- EndIf
- ;~ local $aTemp[1][6] = [[$found[$i + 2], $found[$i], $old, $new, $found[$i + 1], $v]]
- GUICtrlCreateListViewItem($found[$i + 2] & "|" & $found[$i] & "|" & $old & "|" & $new & "|" & $start & $found[$i + 1] & "|" & $v, $idListview)
- ;~ _ArrayAdd($listAllGames, $aTemp)
- Next
- $range = StringRegExp($source, '<div><span class="range">\d*-(\d+)</span>.* (\d+) .*</div>', 3)
- If $range[0] = $range[1] Then
- $end = True
- EndIf
- $v += 1
- ToolTip("Durchsuchte Spiele: " & $range[0] & "/" & $range[1], 0, 0)
- Until $end
- ToolTip("")
- ;~ _ArrayDisplay($listAllGames)
- GUISetState(@SW_SHOW)
- ; Loop until the user exits.
- While 1
- Switch GUIGetMsg()
- Case $GUI_EVENT_CLOSE
- ExitLoop
- Case $idButton
- $splitString = StringSplit(GUICtrlRead(GUICtrlRead($idListview)), "|")
- If IsArray($splitString) Then
- ShellExecute($splitString[5])
- Else
- MsgBox($MB_SYSTEMMODAL, "Link", "Such ein Spiel in der Liste aus!")
- EndIf
- EndSwitch
- WEnd
- Func replaceHTMLEscapes($string)
- $string = StringReplace($string, "€", "€")
- $string = StringReplace($string, "£", "£")
- $string = StringReplace($string, "™", "™")
- $string = StringReplace($string, "©", "©")
- $string = StringReplace($string, "®", "®")
- $string = StringReplace($string, "'", "'")
- return $string
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement