https://github.com/umikoio/thm-iframe-parser
Ingest profile data from TryHackMe's public iframe and convert it to JSON
https://github.com/umikoio/thm-iframe-parser
cybersecurity html iframe json parsing scraping tryhackme
Last synced: 19 days ago
JSON representation
Ingest profile data from TryHackMe's public iframe and convert it to JSON
- Host: GitHub
- URL: https://github.com/umikoio/thm-iframe-parser
- Owner: umikoio
- License: mit
- Created: 2025-09-26T05:36:49.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-09-26T09:59:25.000Z (8 months ago)
- Last Synced: 2025-09-26T11:43:37.639Z (8 months ago)
- Topics: cybersecurity, html, iframe, json, parsing, scraping, tryhackme
- Language: Python
- Homepage:
- Size: 1.32 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
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:
```bash
python3 thm-iframe-parser.py --user 5672619 --output thm_user.json
```
You can save the profile picture locally as well:
```bash
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"):
```bash
python3 thm-iframe-parser.py --user 5672619 | jq ".Data.Badges"
# or
python3 thm-iframe-parser.py --user 5672619 | jq -r ".Data.Streak"
```
## JSON Example
```json
{
"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](https://github.com/umikoio/umikoio/blob/main/.github/workflows/update-readme.yml) 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](https://github.com/umikoio/thm-iframe-parser/issues).