Skip to content

umikoio/thm-iframe-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TryHackMe iframe Parser

Ingest profile data from TryHackMe's public iframe and convert it to JSON.

This project is pretty simple in nature. It ingests the public iframe provided by TryHackMe, parses the incoming data, and converts it to JSON. The JSON report provides almost all of the data you would probably be interested in for sharing info about your TryHackMe account. This tool does not collect any private information or bypass any API infrastructure.

Endpoints

Title Data Type Example
userPublicId Integer 5672619
SourceURL String https://tryhackme.com/api/v2/badges/public-profile?userPublicId=5672619
Rank Integer 464176
Streak String 30 days
Badges Integer 10
CompletedRooms Integer 100
Level String [0x5]
ProfileImage String https://tryhackme-images.s3.amazonaws.com/user-avatars/*

Usage

Output user data to a file:

python3 thm-iframe-parser.py --user 5672619 --output thm_user.json

You can save the profile picture locally as well:

python3 thm-iframe-parser.py --user 5672619 --output thm_user.json --save thm_user.jpg

Parse JSON directly in the terminal (this shows the value for "Badges"):

python3 thm-iframe-parser.py --user 5672619 | jq ".Data.Badges"
# or
python3 thm-iframe-parser.py --user 5672619 | jq -r ".Data.Streak"

JSON Example

{
  "userPublicId": 5672619,
  "SourceURL": "https://tryhackme.com/api/v2/badges/public-profile?userPublicId=5672619",
  "Data": {
    "Rank": 464201,
    "Streak": "9 days",
    "Badges": 7,
    "Completed Rooms": 17,
    "Level": "[0x5]",
    "ProfileImage": "https://tryhackme-images.s3.amazonaws.com/user-avatars/*"
  }
}

Note

Check out the GitHub Workflow I created here that automtically collects TryHackMe public data (this script) and periodically updates a GitHub README.

Important

At any time TryHackMe can change the HTML data within their iframe. This could potentially break the script. If you notice any problems, feel free to open an issue.

About

Ingest profile data from TryHackMe's public iframe and convert it to JSON

Topics

Resources

License

Stars

Watchers

Forks

Languages