Skip to main content

Scrape PSNProfiles profile pages using a Python CLI script

Project description

pypi unit-tests

Python PSNProfiles scraper

Scrape PSNProfiles profile pages using a Python CLI script

Installation

Install Python>=3.9 then in a terminal:

git clone https://github.com/robiningelbrecht/psnprofiles-scraper
pip install -r requirements.txt
python main.py YourUserName (-d)

Or install from PyPi

pip install psnprofiles_scraper

Usage

from psnprofiles_scraper.src.PsnProfilesScraper import PsnProfilesScraper

scraper = PsnProfilesScraper()
# 2nd param indicates if a detailed "scrape" should be executed, takes longer to finish.
print(scraper.get_profile("YourUsername", False).to_json())

Example JSON output

{
  "name": "YourUserName",
  "country": "Belgium",
  "avatar": "https://i.psnprofiles.com/avatars/m/Gc0466d545.png",
  "summary": {
    "level": 354,
    "trophies": {
      "total": 2578,
      "grade": {
        "platinum": 66,
        "gold": 576,
        "silver": 583,
        "bronze": 1353
      },
      "rarity": {
        "ultra_rare": 4,
        "very_rare": 10,
        "rare": 39,
        "uncommon": 406,
        "common": 2119
      }
    },
    "points": {
      "platinum": 19800,
      "gold": 51840,
      "silver": 17490,
      "bronze": 20295,
      "total": 109425
    },
    "games": {
      "played": 165,
      "completed": 61,
      "platforms": {
        "PS5": 4,
        "PS4": 157,
        "PS3": 0,
        "PS Vita": 0,
        "Multiplatform": 4
      },
      "ranks": {
        "S": 61,
        "A": 12,
        "B": 11,
        "C": 14,
        "D": 12,
        "E": 36,
        "F": 19
      }
    },
    "stats": {
      "completion": {
        "average": "56.92%",
        "80% - 100%": 66,
        "60% - 79.99%": 15,
        "40% - 59.99%": 12,
        "20% - 39.99%": 14,
        "0% - 19.99%": 58
      },
      "unearned_trophies": 2685,
      "trophies_per_day": "2.25",
      "views": 501,
      "world_rank": 112163,
      "country_rank": 1486
    }
  },
  "recent_trophies": [
    {
      "title": "Luna's Apprentice",
      "description": "Concrete Genie",
      "rarity_percentage": "90.93%",
      "rarity_label": "Common",
      "grade": "bronze",
      "icon_uri": "https://i.psnprofiles.com/games/e17609/trophies/2Se1a8c6.png",
      "obtained": true
    },
    {
      "title": "Path of the Stars",
      "description": "Shadow of the Tomb Raider",
      "rarity_percentage": "94.29%",
      "rarity_label": "Common",
      "grade": "bronze",
      "icon_uri": "https://i.psnprofiles.com/games/e17609/trophies/2Se1a8c6.png",
      "obtained": true
    }
  ],
  "rarest_trophies": [
    {
      "title": "Blue Series clear",
      "description": "Trackmania Turbo",
      "rarity_percentage": "3.28%",
      "rarity_label": "Ultra Rare",
      "grade": "silver",
      "icon_uri": "https://i.psnprofiles.com/games/4d4c0b/trophies/17S023638.png",
      "obtained": true
    },
    {
      "title": "Stadium Blue clear",
      "description": "Trackmania Turbo",
      "rarity_percentage": "3.45%",
      "rarity_label": "Ultra Rare",
      "grade": "bronze",
      "icon_uri": "https://i.psnprofiles.com/games/4d4c0b/trophies/33Sd54d43.png",
      "obtained": true
    }
  ],
  "milestones": [
    {
      "trophy": "Dragon Break Classic master",
      "trophy_icon": "https://i.psnprofiles.com/games/4d4c0b/trophies/33Sd54d43.png",
      "game": "Dragon Break Classic",
      "description": "Latest Platinum",
      "date": "6 days ago"
    },
    {
      "trophy": "Projectile Pro",
      "trophy_icon": "https://i.psnprofiles.com/games/4d4c0b/trophies/33Sd54d43.png",
      "game": "Immortals Fenyx Rising",
      "description": "2,500th Trophy",
      "date": "4 weeks ago"
    },
    {
      "trophy": "Platinum Paw",
      "trophy_icon": "https://i.psnprofiles.com/games/4d4c0b/trophies/33Sd54d43.png",
      "game": "Thunder Paw",
      "description": "50th Platinum",
      "date": "8 months ago"
    },
    {
      "trophy": "Thank you Mr. Kitty!",
      "trophy_icon": "https://i.psnprofiles.com/games/4d4c0b/trophies/33Sd54d43.png",
      "game": "Red Bow",
      "description": "2,000th Trophy",
      "date": "8 months ago"
    }
  ],
  "games": [
    {
      "title": "Assassin's Creed Syndicate",
      "trophy_stats": {
        "obtained": "32",
        "total": "57",
        "gold": "2",
        "silver": "5",
        "bronze": "25",
        "completion": "56%"
      },
      "platform": "PS4",
      "rank": "B",
      "has_earned_platinum": false,
      "thumbnail_uri": "https://i.psnprofiles.com/games/79c5a1/Sd24d1d.png",
      "uri": "https://psnprofiles.com/trophies/3992-assassins-creed-syndicate/YourUsername"
    },
    {
      "title": "My Name is Mayo",
      "trophy_stats": {
        "obtained": "51",
        "total": "51",
        "gold": "4",
        "silver": "0",
        "bronze": "46",
        "completion": "100%"
      },
      "platform": "PS4",
      "rank": "S",
      "has_earned_platinum": true,
      "thumbnail_uri": "https://i.psnprofiles.com/games/79c5a1/Sd24d1d.png",
      "uri": "https://psnprofiles.com/trophies/5531-my-name-is-mayo/YourUsername"
     }
  ],
  "trophy_cabinet": [
    {
      "title": "Be Yourself",
      "description": "Marvel's Spider-Man: Miles Morales",
      "rarity_percentage": "56.11%",
      "rarity_label": "Common",
      "grade": "platinum",
      "icon_uri": "https://i.psnprofiles.com/games/e17609/trophies/2Se1a8c6.png",
      "obtained": true
    },
    {
      "title": "Viking Legend",
      "description": "Assassin's Creed Valhalla",
      "rarity_percentage": "15.91%",
      "rarity_label": "Rare",
      "grade": "platinum",
      "icon_uri": "https://i.psnprofiles.com/games/e17609/trophies/2Se1a8c6.png",
      "obtained": true
    }
  ],
  "level_history": [
    {
      "level": 20,
      "game": {
        "title": "Assassins Creed Syndicate",
        "thumbnail_uri": "https://i.psnprofiles.com/games/c2af51/S7d1b26.png"
      },
      "trophy": {
        "title": "Bare-Knuckle Champion",
        "description": "Win three different Fight Clubs.",
        "icon_uri": "https://i.psnprofiles.com/games/c2af51/trophies/16Sa76145.png"
      },
      "date": "12th May 2018 10:54:10 AM"
    },
    {
      "level": 10,
      "game": {
        "title": "Assassins Creed Iv Black Flag",
        "thumbnail_uri": "https://i.psnprofiles.com/games/cc3b08/S359338.png"
      },
      "trophy": {
        "title": "Barfly",
        "description": "Unlock all taverns.",
        "icon_uri": "https://i.psnprofiles.com/games/cc3b08/trophies/36Sbcace5.png"
      },
      "date": "29th Apr 2018 9:12:16 AM"
    }
  ]
}

Disclaimer

This app and its creator have no affiliation with PSNProfiles or the PlayStation Network/PlayStation beyond the creator’s use of both services.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

psnprofiles_scraper-1.3.2.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

psnprofiles_scraper-1.3.2-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file psnprofiles_scraper-1.3.2.tar.gz.

File metadata

  • Download URL: psnprofiles_scraper-1.3.2.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.25.1

File hashes

Hashes for psnprofiles_scraper-1.3.2.tar.gz
Algorithm Hash digest
SHA256 e6cec7da8ba07fe886c818db6a163d7b1affb61ffdf12bbca23d9094974e7679
MD5 09fb44a306b1a24f659a82bf273e96b1
BLAKE2b-256 174cfc40b19ce07a1aa8d40e747e644273e0ab5b010d388709689dcf73760dbc

See more details on using hashes here.

File details

Details for the file psnprofiles_scraper-1.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for psnprofiles_scraper-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 81be5ae21ff1a91342ef904f9c87efabd4a8afde6b4fe6c3f071d5f0d3d741c4
MD5 690acb67c5ef1c3994901b420a514c2b
BLAKE2b-256 e49157b227f41e175372922200919adcb2cf9fb6dea41e3d71dcd261180af6c4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page