TrophyFetcher

TrophyFetcher provides a way to extract information from the PSN Public Trophies website. It uses Selenium and PhantomJS to access the website and scrape it, therefore, there are private information that TrophyFetcher is not able to extract (everything that is not on the website).
Installation
You need to install PhantomJS to be able to use TrophyFetcher. There are multiple ways to install it, such as with npm.
$ npm install -g phantomjs
If you do not have npm installed and do not want to install it, I recommend checking their website to look for other alternatives.
To install TrophyFetcher itself, simply do:
$ pip install trophyfetcher
Remember that you need Selenium as well, but pip will most likely that care of that for you.
Tutorial
All you need to do is create a TrophyFetcher object and call the user_info method passing the username of the user you want to extract information from.
from trophyfetcher import TrophyFetcher
tf = TrophyFetcher()
extracted_info = tf.user_info('username')
TrophyFetcher will automatically log errors in a file called trophyfetcher_log.txt, but you can turn that off by doing:
from trophyfetcher import TrophyFetcher
tf = TrophyFetcher()
tf.logging_option(False)
extracted_info = tf.user_info('username')
If a problem occurs and Selenium is not able to locate elements on the page, TrophyFetcher will raise a TimeoutException and log (if logging is enabled) which element caused the error. If that happens, it is most likely due to slow connection or a problem with the website, since TrophyFetcher will wait until 30 seconds before it raises the TimeoutException.
Finally, if everything goes well, you will receive an object in the following format (JSON):
{
"avatar_url": "https://avatar_example.png",
"bronze_trophies": "0",
"games_info": [{
"bronze_trophies": "0",
"gold_trophies": "0",
"img_url": "https://game_example.png",
"name": "example",
"platform": "example platform",
"platinum_trophies": "0",
"progress": "0%",
"silver_trophies": "0"
}],
"gold_trophies": "0",
"level": "0",
"level_progress": "0",
"platinum_trophies": "0",
"silver_trophies": "0",
"trophies": "0"
}
Release files for trophyfetcher 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| trophyfetcher-0.1.0.tar.gz | 5.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| trophyfetcher-0.1.0-py2-none-any.whl | Python 2 | none | any | Details |
Total release size: 29.3 kB
Release files / trophyfetcher-0.1.0.tar.gz
| Download URL | trophyfetcher-0.1.0.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4e3f6de8704530ba4cc1b59595ac7976952d26cd30f9bfaeed92b8c203ad3963
|
|
BLAKE2b-256 checksum How to use checksums |
365243189a40f9cb5672779dcfbab430dbe1fe082095f12cb97ce417cf3eb738
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / trophyfetcher-0.1.0-py2-none-any.whl
| Download URL | trophyfetcher-0.1.0-py2-none-any.whl |
|---|---|
| Size | 23.6 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
f415e6022a8914e439c17226d67136945d297fa6eecfd6488c46fb26cef2098f
|
|
BLAKE2b-256 checksum How to use checksums |
ce26bf75941451b7f605799f77eb86d6ae8e29d213e87a71ffee142f35ad8be7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |