Main.py 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. import requests
  2. import json
  3. import time
  4. import datetime
  5. # Make list of searched groups (debug för att ma aldrig får några valid, varna för duplicate)
  6. # Kolla på de andra api för att hämta grupper
  7. # ----------------------------------------------------------------- #
  8. keyword = "aaaa"
  9. exactMatch = False
  10. groupCount = 100 # 10, 25, 50, 100
  11. howManyCycles = 2
  12. delayTime = 0
  13. groupMaxMembers = 10
  14. groupHasFunds = False
  15. publicGroup = True
  16. hasOwner = False
  17. saveInFile = True
  18. # ----------------------------------------------------------------- #
  19. url = "https://groups.rprxy.xyz/v1/groups/search?keyword=" + keyword + "&prioritizeExactMatch=" + str(
  20. exactMatch).lower() + "&limit=" + str(groupCount)
  21. # fundsUrl = "https://economy.roblox.com/v1/groups/GROUP/currency"
  22. foundGroups = []
  23. groupIdList = []
  24. lookedGroups = {}
  25. nextPageCursor = "yes"
  26. try:
  27. for cycle in range(0, howManyCycles):
  28. print("[WORKING] Cycle number: " + str(cycle))
  29. print("[WORKING] Percentage: " + str(int((cycle / howManyCycles) * 1000) / 10) + "%")
  30. if not nextPageCursor:
  31. break
  32. elif nextPageCursor == "yes":
  33. nextPageCursor = ""
  34. requestData = requests.get(url + "&cursor=" + nextPageCursor) # Forgot to add nextPageCursor, ruined the program...
  35. # print(requestData.json())
  36. dataTable = json.loads(requestData.content)
  37. try:
  38. nextPageCursor = dataTable["nextPageCursor"]
  39. except:
  40. nextPageCursor = ""
  41. for group in dataTable["data"]:
  42. if group["id"] in lookedGroups:
  43. print("[WARN] Duplicate Group: " + group["name"])
  44. continue
  45. # else:
  46. # lookedGroups[group["id"]] = True
  47. valid = True
  48. # print(str(group["memberCount"]))
  49. if group["memberCount"] > groupMaxMembers:
  50. valid = False
  51. if publicGroup and not group["publicEntryAllowed"]:
  52. valid = False
  53. if groupHasFunds:
  54. fundsUrl = "https://economy.rprxy.xyz/v1/groups/" + str(group["id"]) + "/currency"
  55. economyData = requests.get(fundsUrl)
  56. economyJSON = json.loads(economyData.content)
  57. try:
  58. if economyJSON["robux"] == 0:
  59. valid = False
  60. except:
  61. valid = False
  62. if valid:
  63. print("[INFO] Found valid group " + str(group["id"]))
  64. # group["description"] = ""
  65. # group["name"] = ""
  66. foundGroups.append(group)
  67. groupIdList.append(group["id"])
  68. # else:
  69. # print("Invalid group")
  70. time.sleep(delayTime)
  71. except:
  72. print("[ERROR] Error in loop")
  73. if foundGroups.__len__() > 0 and saveInFile:
  74. thisTime = datetime.datetime.today()
  75. fileTime = str(thisTime.year) + "-" + str(thisTime.month) + "-" + str(thisTime.day) + "_" + str(
  76. thisTime.hour) + "-" + str(thisTime.minute) + "-" + str(thisTime.second)
  77. with open("./run/foundGroups_" + fileTime + ".txt", "w", encoding='utf-8') as groupFile:
  78. for line in foundGroups:
  79. groupFile.write(line.__str__())
  80. groupFile.write("\n")
  81. # groupFile.close()
  82. with open("./run/foundGroupIds" + fileTime + ".txt", "w", encoding='utf-8') as groupIdFile:
  83. for line in groupIdList:
  84. groupIdFile.write(str(line))
  85. print(str(line))
  86. groupIdFile.write("\n")
  87. # groupIdFile.close()
  88. groupIdItt = groupIdList
  89. if not hasOwner:
  90. for groupId in groupIdItt:
  91. time.sleep(2)
  92. ownerUrl = "https://groups.rprxy.xyz/v1/groups/" + str(groupId)
  93. print(ownerUrl)
  94. groupData = requests.get(ownerUrl)
  95. groupJSON = json.loads(groupData.content)
  96. try:
  97. if groupJSON["owner"]["userId"]:
  98. groupIdList.remove(groupId)
  99. foundGroups.remove(groupId)
  100. print("Has owner")
  101. print(groupJSON)
  102. else:
  103. print("No owner")
  104. print(groupJSON)
  105. except:
  106. print("No owner error")
  107. print(groupJSON)
  108. print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nSEARCH COMPLETE")
  109. print("Found groups: " + str(foundGroups.__len__()))
  110. print(foundGroups)
  111. print("\nFound group ids:")
  112. print(groupIdList)