diff --git a/raw_data.py b/raw_data.py index 3c3bb6c..eeb41d4 100644 --- a/raw_data.py +++ b/raw_data.py @@ -1,3 +1,7 @@ connection_init = r"""{"type":"connection_init","payload":{"Authorization":"Bearer %s"}}""" id1 = r"""{"id":"1","type":"start","payload":{"variables":{"input":{"channel":{"teamOwner":"AFD2022","category":"CONFIG"}}},"extensions":{},"operationName":"configuration","query":"subscription configuration($input: SubscribeInput!) {\n subscribe(input: $input) {\n id\n ... on BasicMessage {\n data {\n __typename\n ... on ConfigurationMessageData {\n colorPalette {\n colors {\n hex\n index\n __typename\n }\n __typename\n }\n canvasConfigurations {\n index\n dx\n dy\n __typename\n }\n canvasWidth\n canvasHeight\n __typename\n }\n }\n __typename\n }\n __typename\n }\n}\n"}}""" -id2 = r"""{"id":"2","type":"start","payload":{"variables":{"input":{"channel":{"teamOwner":"AFD2022","category":"CANVAS","tag":"0"}}},"extensions":{},"operationName":"replace","query":"subscription replace($input: SubscribeInput!) {\n subscribe(input: $input) {\n id\n ... on BasicMessage {\n data {\n __typename\n ... on FullFrameMessageData {\n __typename\n name\n timestamp\n }\n ... on DiffFrameMessageData {\n __typename\n name\n currentTimestamp\n previousTimestamp\n }\n }\n __typename\n }\n __typename\n }\n}\n"}}""" +idX_template = r"""{"id":"%s","type":"start","payload":{"variables":{"input":{"channel":{"teamOwner":"AFD2022","category":"CANVAS","tag":"%s"}}},"extensions":{},"operationName":"replace","query":"subscription replace($input: SubscribeInput!) {\n subscribe(input: $input) {\n id\n ... on BasicMessage {\n data {\n __typename\n ... on FullFrameMessageData {\n __typename\n name\n timestamp\n }\n ... on DiffFrameMessageData {\n __typename\n name\n currentTimestamp\n previousTimestamp\n }\n }\n __typename\n }\n __typename\n }\n}\n"}}""" +id2 = idX_template % (2, 0) +id3 = idX_template % (3, 1) +id4 = idX_template % (4, 2) +id5 = idX_template % (5, 3) diff --git a/script.py b/script.py index bfba522..03d9f21 100644 --- a/script.py +++ b/script.py @@ -53,7 +53,10 @@ class PlaceScraper: send1 = raw_data.connection_init % self.token send2 = raw_data.id1 send3 = raw_data.id2 - for send in send1, send2, send3: + send4 = raw_data.id3 + send5 = raw_data.id4 + send6 = raw_data.id5 + for send in send1, send2, send3, send4, send5: await ws.send(send) await self.add_to_db(self.db, "sent_ws", {"sent": send, "time": time.time()}) async def run_forever(self): diff --git a/warcprox-individual-iterate.py b/warcprox-individual-iterate.py index 6e4c62e..44d6c56 100644 --- a/warcprox-individual-iterate.py +++ b/warcprox-individual-iterate.py @@ -12,13 +12,14 @@ tok = refresh_token() for x in range(0, 1000): for y in range(0, 1000): - data = {"operationName":"pixelHistory","variables":{"input":{"actionName":"r/replace:get_tile_history","PixelMessageData":{"coordinate":{"x":x,"y":y},"colorIndex":0,"canvasIndex":3}}},"query":"mutation pixelHistory($input: ActInput!) {\n act(input: $input) {\n data {\n ... on BasicMessage {\n id\n data {\n ... on GetTileHistoryResponseMessageData {\n lastModifiedTimestamp\n userInfo {\n userID\n username\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n }\n}\n"} - ep = "https://gql-realtime-2.reddit.com/query" - head = {"Authorization": f"Bearer {tok}", "Origin": "https://hot-potato.reddit.com"} - a = requests.post(ep, json=data, headers=head) - while a.status_code != 200: - print(a.text) + for canvas in range(0, 5): + data = {"operationName":"pixelHistory","variables":{"input":{"actionName":"r/replace:get_tile_history","PixelMessageData":{"coordinate":{"x":x,"y":y},"colorIndex":0,"canvasIndex":canvas}}},"query":"mutation pixelHistory($input: ActInput!) {\n act(input: $input) {\n data {\n ... on BasicMessage {\n id\n data {\n ... on GetTileHistoryResponseMessageData {\n lastModifiedTimestamp\n userInfo {\n userID\n username\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n }\n}\n"} + ep = "https://gql-realtime-2.reddit.com/query" + head = {"Authorization": f"Bearer {tok}", "Origin": "https://hot-potato.reddit.com"} a = requests.post(ep, json=data, headers=head) - tok = refresh_token() - print("Added", x, y) - time.sleep(0.09) + while a.status_code != 200: + print(a.text) + a = requests.post(ep, json=data, headers=head) + tok = refresh_token() + print("Added", x, y) + time.sleep(0.09)