A package used to fetch public information about trophies from PSN.
Project description
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"
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for trophyfetcher-0.1.0-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f415e6022a8914e439c17226d67136945d297fa6eecfd6488c46fb26cef2098f |
|
MD5 | c101e0955ac6df9381af83570fd4c844 |
|
BLAKE2b-256 | ce26bf75941451b7f605799f77eb86d6ae8e29d213e87a71ffee142f35ad8be7 |