Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import re
import json
running_game = r"""
Here some nice debugging message.
{ "type": "device",
"statusLine": "200 Ok",
"statusCode": "200",
"status": "Ok",
"host-id": "BC60A766BA99",
"host-type": "PS4",
"host-name": "PS4",
"host-request-port": "997",
"device-discovery-protocol-version": "00020020",
"system-version": "04550011",
"running-app-name": "Curses 'N Chaos",
"running-app-titleid": "CUSA03106",
"address": "192.168.1.75" }
Another one right here.
"""
# Get data between {}.
game_data = re.findall(r'{([^]]*)}', running_game)[0]
game_data = '{%s}' % game_data
the_actual_data = json.loads(game_data)
print(the_actual_data['running-app-name'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.