Kijan

PSVRAF

Jul 1st, 2020
4,031
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <array.au3>
  2. #include <Inet.au3>
  3. #include <GUIConstantsEx.au3>
  4. #include <MsgBoxConstants.au3>
  5. #include <WindowsConstants.au3>
  6.  
  7. $start = "https://store.playstation.com"
  8. $siteBase = "https://store.playstation.com/de-de/grid/STORE-MSF75508-PLAYSTATIONVRHUB/"
  9. ;~ local $listAllGames[1][6] = [["Name", "Prozente" ,"Alter Preis", "Neuer Preis", "Link", "Seite"]]
  10.  
  11.  
  12. GUICreate("Playstation VR Angebots-Finder", 620, 520, 100, 200)
  13. GUISetBkColor(0x00E0FFFF) ; will change background color
  14.  
  15. Local $idListview = GUICtrlCreateListView("Name                                 |Prozente|Alter Preis|Neuer Preis|Link|Seite", 10, 10, 600, 410) ;,$LVS_SORTDESCENDING)
  16. Local $idButton = GUICtrlCreateButton("Link öffnen?", 10, 450, 600, 20)
  17.  
  18. $end = False
  19. $v = 1
  20. Do
  21.     local $source = replaceHTMLEscapes(_INetGetSource($siteBase & $v))
  22.  
  23.     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)
  24.  
  25.     For $i = 0 To UBound($found)-1 Step 4
  26.         local $foundPrice = StringRegExp($found[$i + 3], '<div class="price">(.*)</div>(?s).*(?-s)<h3 class="price-display__price">(.*)</h3>', 3)
  27.         local $old = ""
  28.         local $new = ""
  29.         If IsArray($foundPrice) Then
  30.             $old = $foundPrice[0]
  31.             $new = $foundPrice[1]
  32.         Else
  33.             $foundPrice = StringRegExp($found[$i + 3], '<h3 class="price-display.*>(.*)</h3>', 3)
  34.             $old = ""
  35.             $new = $foundPrice[0]
  36.         EndIf
  37.  
  38. ;~      local $aTemp[1][6] = [[$found[$i + 2], $found[$i], $old, $new, $found[$i + 1], $v]]
  39.         GUICtrlCreateListViewItem($found[$i + 2] & "|" & $found[$i] & "|" & $old & "|" & $new & "|" & $start & $found[$i + 1] & "|" & $v, $idListview)
  40. ;~      _ArrayAdd($listAllGames, $aTemp)
  41.     Next
  42.  
  43.     $range = StringRegExp($source, '<div><span class="range">\d*-(\d+)</span>.* (\d+) .*</div>', 3)
  44.  
  45.     If $range[0] = $range[1] Then
  46.         $end = True
  47.     EndIf
  48.     $v += 1
  49.     ToolTip("Durchsuchte Spiele: " & $range[0] & "/" & $range[1], 0, 0)
  50. Until $end
  51.  
  52. ToolTip("")
  53.  
  54. ;~ _ArrayDisplay($listAllGames)
  55.  
  56. GUISetState(@SW_SHOW)
  57.  
  58. ; Loop until the user exits.
  59. While 1
  60.     Switch GUIGetMsg()
  61.         Case $GUI_EVENT_CLOSE
  62.             ExitLoop
  63.         Case $idButton
  64.             $splitString = StringSplit(GUICtrlRead(GUICtrlRead($idListview)), "|")
  65.             If IsArray($splitString) Then
  66.                 ShellExecute($splitString[5])
  67.             Else
  68.                 MsgBox($MB_SYSTEMMODAL, "Link", "Such ein Spiel in der Liste aus!")
  69.             EndIf
  70.     EndSwitch
  71. WEnd
  72.  
  73.  
  74.  
  75.  
  76. Func replaceHTMLEscapes($string)
  77.     $string = StringReplace($string, "&#x20AC;", "€")
  78.     $string = StringReplace($string, "&#xA3;", "£")
  79.     $string = StringReplace($string, "&#x2122;", "™")
  80.     $string = StringReplace($string, "&#xA9;", "©")
  81.     $string = StringReplace($string, "&#xAE;", "®")
  82.     $string = StringReplace($string, "&apos;", "'")
  83.     return $string
  84. EndFunc
RAW Paste Data