Created
May 3, 2017 07:10
-
-
Save CoalaJoe/8a67b410062e40afc3b8414af91ca79e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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