Skip to content

Instantly share code, notes, and snippets.

@sophiezhng
Last active June 6, 2021 09:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sophiezhng/89e1f887202da95d92f4b49e1fba7236 to your computer and use it in GitHub Desktop.
Save sophiezhng/89e1f887202da95d92f4b49e1fba7236 to your computer and use it in GitHub Desktop.
Check MySpace Windows 93 notifications for a user
import json
import requests
user_id = "" #ENTER YOUR ID INSIDE THE QUOTES e.g., user_id = "31453"
def main():
r = requests.get('https://myspace.windows93.net/api.php?id='+user_id)
user = make_json_request(r)
notifs = user['notifications']
changes_exist = False
if notifs['new fwiend requests'] == True:
print("You have new fwiend requests!")
changes_exist = True
if notifs['new message'] == True:
print("You have messages!")
changes_exist = True
if notifs['new comment'] == True:
print("You have new comment(s)!")
changes_exist = True
if notifs['new blog comment'] == True:
print("You have new blog comment(s)!")
changes_exist = True
if changes_exist == False:
print('Nothing new')
def make_json_request(request):
json = request.json()
if json["success"] == 'false':
print("ERROR: "+json["msg"])
exit(1)
else:
return json
if __name__ == "__main__":
main()
@H3wastooshort
Copy link

H3wastooshort commented Jun 4, 2021

Nice script! I added looping, multiuser support, and a notification tone:

import json
import requests
import time
from playsound import playsound

user_IDs = ["77990", "82448"]

user_id = ""

def main():
    r = requests.get('https://myspace.windows93.net/api.php?id='+user_id)
    user = make_json_request(r)
    notifs = user['notifications']
    
    changes_exist = False
    
    #print("For " + user_id + ": ")
    print("For " + user['name'] + ":")

    if notifs['new fwiends'] == True:
        print("You have new fwiends")
        changes_exist = True
    
    if notifs['new fwiend requests'] == True:
        print("You have new fwiend requests!")
        changes_exist = True
        
    if notifs['new message'] == True:
        print("You have messages!")
        changes_exist = True

    if notifs['new comment'] == True:
        print("You have new comment(s)!")
        changes_exist = True
        
    if notifs['new blog comment'] == True:
        print("You have new blog comment(s)!")
        changes_exist = True

    if changes_exist == False:
        print('Nothing new')
    else:
        playsound("notify.wav")
    
    print("")
    

def make_json_request(request):
    json = request.json()
    if json["success"] == 'false':
        print("ERROR: "+json["msg"])
        exit(1)
    else:
        return json

if __name__ == "__main__":
    while True:
        for user_id in user_IDs:
            main()
            time.sleep(10)

EDIT: Now shows name instead of ID
EDIT2: also shows new fwiends

@H3wastooshort
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment