Here is the PHP script I use to download my monthly Envato CSV Statements for in-house processing. You could use this to:
- graph your item sales
- automatically calculate split earnings on collaboration items
- anything else that isn’t possible with the current earnings API
This script works by first logging into the marketplace using your Envato username/password. It then downloads a copy of your CSV statements into a temporary folder. It will only download the CSV statements once and cache them for future requests (except the most recent statement, which it grabs new each time).
require_once 'class.envato_scraper.php'; $my_scraper = new envato_scraper(); $my_scraper->do_login('username','password'); $statement = $my_scraper->get_statement('1/2013'); // get csv from Jan 2013 to now. print_r($statement);
Array (  => Array ( [type] => sale [date] => 2013-01-31 23:43:06 +1100 [time] => 1359636186 [item] => WordPress Email Ticket Support Plugin [item_id] => 254823 [envato_item_id] => 0 [earnt] => 15.40 [amount] => 22.00 [rate] => 70.0 )  => Array ( [type] => sale [date] => 2013-01-31 22:16:25 +1100 [time] => 1359630985 [item] => PHP Search Engine [item_id] => 89499 [envato_item_id] => 0 [earnt] => 7.00 [amount] => 10.00 [rate] => 70.0 ) etc....
Place this script on a web server somewhere (probably best a local web server). The first time you run this script please run it from a web browser, because it will probably ask you for a re-captch code (yes, it handles re-captcha on the envato login screen! cool ey!) after that first run and captcha code you should be right to automate the script from a cron job or similar.
Code here, feel free to fork and modify: https://github.com/dtbaker/envato-scraper
I look forward to seeing some new cool interesting apps made with this scraper/API, please share your creations back with the community here
Commission Split Calculator
And here is the basic Envato Commission Split Calculator script.
I’m using this on one of my items so both myself and the other author can get up to date commission split information.https://github.com/dtbaker/envato-scraper/blob/master/commission-split.php
So I send a special URL to the other author and they can see up to date sales and commission information on the joint item, example:
This looks really good! Thanks for sharing, will definitely give it a try!
However, i have a concern.. Is this safe?
RubenBristian saidcertainly not safe at all but there are things that are not possible with the current API, so the only way I can automate them is using my account password and a script like this.
Is this safe?define('_ENVATO_PASSWORD','your_envato_password');
yeah i know that the API could be improved a lot. I’ve requested this feature(detailed earnings per file per month) some time ago specifically for this reason..
failed. no auth token found on pagefailed. no auth token found on pageUnable to login. Sorry, please try again shortly.failed, probably not logged in correctly, invalid month or envato is temporarily down. M
- Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
- Open a support ticket if you would like specific help with your account, deposits or purchases.
- Item Support by authors is optional and may vary. Please see the Support tab on each item page.
Most of all, enjoy your time here. Thank you for being a valued Envato community member.