https://cdn.steemitimages.com/DQmc5BTWMSBD2LhFGKFKZWcFPhjNeWt9AEykV6FTakkaEhW/image.png <center><sub>Screenshot of my script in action in the [Brave browser](https://brave.com/myc159) Console</sub></center> Tonight I read someone in a Discord channel wondering how we can programmatically read a user's RC. I could not find any documentation online, so I start researching which websites currently display a RC bar. After investigating some of their network calls without success, I started looking at their minified code and found something that seemed doing what I was looking for. After prettifying it with an online tool and digging a bit more into it I figure it out. So here it is in case you need it as well: <code><pre> var TARGET_ACCOUNT = 'cribbio'; var getResourceCredits = (user) => new Promise((resolve) => { fetch('https://api.steemit.com', { credentials: 'omit', headers: { accept: 'application/json', 'accept-language': 'en-US,en;q=0.9', 'cache-control': 'max-age=0', 'content-type': 'application/json;charset=UTF-8', 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'cross-site', }, referrer: 'https://steemit.com/@marcocasario', referrerPolicy: 'no-referrer-when-downgrade', body: JSON.stringify({ id: '1', jsonrpc: '2.0', method: 'rc_api.find_rc_accounts', params: {'accounts': [user]}, }), method: 'POST', mode: 'cors', }) .then(res => res.json()) .then(({ result } = {}) => { const { rc_manabar, max_rc } = result.rc_accounts[0]; const time = Math.round((new Date).getTime() / 1e3) - rc_manabar.last_update_time; const maxMana = parseInt(max_rc); const currentMana = parseInt(rc_manabar.current_mana) + Math.round(maxMana / 432e3 * time); const percentage = Math.min(currentMana / maxMana * 100, 100); resolve(percentage); }); }); getResourceCredits(TARGET_ACCOUNT) .then((result) => console.log(TARGET_ACCOUNT, 'is at', result, '% of their RC.')); <pre><code> ----- <h4>USAGE:</h4> This is even easier than [retrieving a Steemit account information programmatically](https://steemit.com/steemit/@gaottantacinque/here-is-how-you-can-easily-get-steemit-accounts-information-programmatically) as there is no need to import SteemJs or SteemdJs. It simply uses a cross domain http requests (see [documentation on developers.steem.io](https://developers.steem.io/apidefinitions/#rc_api.find_rc_accounts)). This means that you can try this simple script in any webpage. <h5>Step by step instructions:</h5> <h4>STEP 1</h4> Open your favorite browser on any site (I strongly recommend to use [Brave browser](https://brave.com/myc159), by the way) and open the DevTools (Ctrl + Shift + J on Linux/Windows and Cmd + Opt + J on Mac). <h4>STEP 2</h4> Copy and paste my script above in the Console. <h4>STEP 3</h4> Press enter and there you go! You can now see a console log telling you the percentage of RC still available to the target user. If you want to retry with a different user simply paste the script again, change the top variable and press enter again. Enjoy!! =] NOTE: As usual, this script is completely safe as it does not require any sort of keys to function!
author | gaottantacinque | ||||||
---|---|---|---|---|---|---|---|
permlink | here-is-how-you-can-easily-get-a-steemit-account-resource-credit-amount-programmatically | ||||||
category | steemit | ||||||
json_metadata | {"tags":["stem","blockchain","neoxian","palnet","programming","javascript","art"],"links":["https://brave.com/myc159","https://api.steemit.com","https://steemit.com/@marcocasario","https://steemit.com/steemit/@gaottantacinque/here-is-how-you-can-easily-get-steemit-accounts-information-programmatically","https://developers.steem.io/apidefinitions/#rc_api.find_rc_accounts"],"app":"steemit/0.1","format":"markdown","image":["https://cdn.steemitimages.com/DQmc5BTWMSBD2LhFGKFKZWcFPhjNeWt9AEykV6FTakkaEhW/image.png"]} | ||||||
created | 2020-01-23 09:38:24 | ||||||
last_update | 2020-01-23 09:53:18 | ||||||
depth | 0 | ||||||
children | 6 | ||||||
last_payout | 2020-01-30 09:38:24 | ||||||
cashout_time | 1969-12-31 23:59:59 | ||||||
total_payout_value | 7.487 HBD | ||||||
curator_payout_value | 8.307 HBD | ||||||
pending_payout_value | 0.000 HBD | ||||||
promoted | 0.000 HBD | ||||||
body_length | 3,893 | ||||||
author_reputation | 13,463,378,539,470 | ||||||
root_title | "Here is how you can easily get a Steemit account Resource Credit amount programmatically" | ||||||
beneficiaries |
| ||||||
max_accepted_payout | 1,000,000.000 HBD | ||||||
percent_hbd | 10,000 | ||||||
post_id | 94,678,825 | ||||||
net_rshares | 56,494,148,289,705 | ||||||
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
ausbitbank | 0 | 2,331,219,022,630 | 100% | ||
jrcornel | 0 | 7,104,961,851,362 | 100% | ||
jschindler | 0 | 167,436,134,891 | 50% | ||
appalachain | 0 | 10,354,418,260 | 100% | ||
zer0hedge | 0 | 455,349,155,253 | 100% | ||
steem.lol | 0 | 167,857,223,681 | 100% | ||
finprep | 0 | 472,333,527,190 | 100% | ||
guiltyparties | 0 | 312,351,012,904 | 100% | ||
lightproject | 0 | 12,056,884,073 | 100% | ||
hdmed | 0 | 56,210,495,452 | 100% | ||
freezepeach | 0 | 142,592,878,668 | 100% | ||
steemorocco | 0 | 1,271,672,488 | 100% | ||
morwhale | 0 | 3,833,034,587 | 100% | ||
nathanpieters | 0 | 2,028,775,278 | 50% | ||
x30 | 0 | 8,300,585,425,651 | 100% | ||
theredshark | 0 | 541,452,011 | 100% | ||
wahedkado | 0 | 541,372,016 | 100% | ||
morwhaleplus | 0 | 1,003,006,634 | 100% | ||
zidfabour | 0 | 541,168,047 | 100% | ||
zakdour | 0 | 540,680,160 | 100% | ||
abdoramon | 0 | 539,648,034 | 100% | ||
atfkamal | 0 | 539,433,825 | 100% | ||
anasjen | 0 | 539,492,839 | 100% | ||
marofat | 0 | 539,850,219 | 100% | ||
morwhalebox | 0 | 540,203,334 | 100% | ||
morwhalebonus | 0 | 980,492,711 | 100% | ||
bamomed | 0 | 540,208,545 | 100% | ||
bensaid | 0 | 540,303,336 | 100% | ||
abdohrich | 0 | 540,176,415 | 100% | ||
akirano | 0 | 539,305,090 | 100% | ||
safro | 0 | 540,326,348 | 100% | ||
majjido | 0 | 539,400,203 | 100% | ||
najmaoui | 0 | 540,007,782 | 100% | ||
makirano | 0 | 540,537,133 | 100% | ||
morwhalelive | 0 | 540,614,480 | 100% | ||
morwhalelife | 0 | 540,536,703 | 100% | ||
morwhaletrail | 0 | 540,473,738 | 100% | ||
morwhalered | 0 | 540,603,606 | 100% | ||
blamer | 0 | 541,541,823 | 100% | ||
mryana | 0 | 540,253,903 | 100% | ||
steemwild | 0 | 541,198,063 | 100% | ||
teammorocco | 0 | 4,880,764,890 | 100% | ||
feedme | 0 | 759,275,651 | 100% | ||
nwijoo | 0 | 628,170,791 | 100% | ||
nadiirsafaa | 0 | 540,940,831 | 100% | ||
hachmanisabir | 0 | 541,952,079 | 100% | ||
morwhaletip | 0 | 540,475,645 | 100% | ||
morwhaletips | 0 | 540,490,016 | 100% | ||
rewardshare | 0 | 540,671,275 | 100% | ||
rewardsshare | 0 | 540,354,226 | 100% | ||
katchoro | 0 | 539,716,930 | 100% | ||
agentsql | 0 | 539,629,726 | 100% | ||
borntobe | 0 | 539,671,611 | 100% | ||
dzivenu | 0 | 14,018,914,922 | 100% | ||
morwhalear | 0 | 540,230,960 | 100% | ||
morwhalefr | 0 | 540,225,529 | 100% | ||
steemox | 0 | 539,285,440 | 100% | ||
zouhalsana | 0 | 541,099,472 | 100% | ||
ramanisafwan | 0 | 540,850,374 | 100% | ||
sarmitirajaa | 0 | 655,684,008 | 100% | ||
raghifjamila | 0 | 540,738,782 | 100% | ||
malihamoussa | 0 | 540,800,140 | 100% | ||
aminamarchalik | 0 | 540,841,086 | 100% | ||
mardibachir | 0 | 540,569,372 | 100% | ||
anoirelgama | 0 | 540,725,112 | 100% | ||
elhajjasaidia | 0 | 540,545,176 | 100% | ||
sakanijalal | 0 | 540,504,086 | 100% | ||
moroccoteam | 0 | 627,346,504 | 100% | ||
najat | 0 | 3,684,222,014 | 100% | ||
fourfourfun | 0 | 6,471,937,412 | 25% | ||
oliverschmid | 0 | 1,013,757,070,441 | 100% | ||
hdmed.dev | 0 | 663,786,067 | 100% | ||
mmmmkkkk311 | 0 | -683,542,718,525 | -10% | ||
flysky | 0 | 403,947,799,733 | 6% | ||
minnowvotes | 0 | 291,289,694,531 | 8.01% | ||
raise-me-up | 0 | 0 | 0.01% | ||
mariuszkarowski | 0 | -45,063,398,316 | -10% | ||
statsexpert | 0 | 1,698,551,840 | 20% | ||
saboin | 0 | 46,452,765,267 | 10% | ||
kamalamezwar | 0 | 717,972,075 | 100% | ||
eii | 0 | 3,427,329,993 | 10% | ||
enforcer48 | 0 | 54,995,250,154 | 15% | ||
gaottantacinque | 0 | 1,700,365,163 | 100% | ||
hansgans | 0 | 20,470,757,564 | 100% | ||
gasaeightyfive | 0 | 3,498,861,959 | 100% | ||
marcocasario | 0 | 32,725,576,307 | 100% | ||
laissez-faire | 0 | 53,046,422 | 100% | ||
tonalddrump | 0 | 11,562,972,362 | 99% | ||
eternalsuccess | 0 | 39,898,083,306 | 50% | ||
bigmoneyman | 0 | 900,131,958 | 50% | ||
nextcolony | 0 | 5,292,468,383,051 | 100% | ||
likwid | 0 | 30,368,136,219,925 | 100% | ||
wizardofaus | 0 | 3,972,178,539 | 100% | ||
cn-neoxag | 0 | 10,844,487 | 2% | ||
ticketyboo | 0 | 7,186,849,836 | 75% | ||
ticketywoof | 0 | 7,186,988,703 | 75% | ||
curation.stem | 0 | 0 | 75% | ||
mk-pal-token | 0 | -316,642,263 | -10% | ||
mk-sports-token | 0 | -690,639,932 | -10% | ||
mk-natrl-token | 0 | -339,148,546 | -10% | ||
mk-stem-token | 0 | -346,781,065 | -10% | ||
mk-gg-token | 0 | -346,781,054 | -10% | ||
mk-marlians-tkn | 0 | -346,781,045 | -10% | ||
mk-leo-token | 0 | -345,198,160 | -10% | ||
mk-tunes-token | 0 | -147,559,433 | -10% | ||
mk-photo-token | 0 | -544,847,482 | -10% | ||
alafaqueyou | 0 | 1,609,460,303 | 100% | ||
borbina | 0 | 4,330,742,027 | 75% | ||
yggdrasil.laguna | 0 | 326,052,707 | 70% | ||
upyournose | 0 | 6,788,879,750 | 86% | ||
rubberhose | 0 | 6,788,607,545 | 86% | ||
kromlek | 0 | -9,179,925 | -10% | ||
neoxvoter | 0 | 87,334,701 | 1.5% | ||
ilovemk311 | 0 | 4,944,527,908 | 50% | ||
abuse-signal | 0 | -3,879,552,599 | -10% |
<div class='pull-right'>https://cdn.steemitimages.com/DQmaHThyECGhEx8tSfHZbiMFRNYjJ35K92cDgiJjkzBUaJo/One%20sip%20of%20BEER%20for%20you.gif<p><sup><a href='https://steem-engine.com/?p=market&t=BEER'>View or trade </a> <code>BEER</code>.</sup></p></div><center><br> <p> Hey @gaottantacinque, here is a little bit of <code>BEER</code> from @eii for you. Enjoy it!</p> <p>Learn how to <a href='https://steemit.com/beer/@beerlover/what-is-proof-of-stake-with-beer'>earn FREE BEER each day </a> by staking.</p> </center><div></div>
author | beerlover |
---|---|
permlink | re-here-is-how-you-can-easily-get-a-steemit-account-resource-credit-amount-programmatically-20200124t153847z |
category | steemit |
json_metadata | "{"app": "beem/0.21.1"}" |
created | 2020-01-24 15:38:51 |
last_update | 2020-01-24 15:38:51 |
depth | 1 |
children | 0 |
last_payout | 2020-01-31 15:38:51 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 526 |
author_reputation | 25,764,592,104,293 |
root_title | "Here is how you can easily get a Steemit account Resource Credit amount programmatically" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 94,726,575 |
net_rshares | 0 |
!shop $trdo !BEER for you
author | eii |
---|---|
permlink | re-gaottantacinque-q4mbgf |
category | steemit |
json_metadata | {"tags":["steemit"],"app":"steempeak/2.2.8"} |
created | 2020-01-24 15:38:36 |
last_update | 2020-01-24 15:38:36 |
depth | 1 |
children | 0 |
last_payout | 2020-01-31 15:38:36 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 25 |
author_reputation | 181,231,422,780,786 |
root_title | "Here is how you can easily get a Steemit account Resource Credit amount programmatically" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 94,726,569 |
net_rshares | 0 |
You got a 8.01% upvote from @minnowvotes courtesy of @steemium!
author | minnowvotes |
---|---|
permlink | re-gaottantacinque-here-is-how-you-can-easily-get-a-steemit-account-resource-credit-amount-programmatically-20200125t062621986z |
category | steemit |
json_metadata | {"app":"postpromoter/2.1.1"} |
created | 2020-01-25 06:26:21 |
last_update | 2020-01-25 06:26:21 |
depth | 1 |
children | 0 |
last_payout | 2020-02-01 06:26:21 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 64 |
author_reputation | -125,291,280,752 |
root_title | "Here is how you can easily get a Steemit account Resource Credit amount programmatically" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 94,746,277 |
net_rshares | 0 |
Congratulations @gaottantacinque! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) : <table><tr><td><img src="https://steemitimages.com/60x70/http://steemitboard.com/@gaottantacinque/commented.png?202001241904"></td><td>You got more than 400 replies. Your next target is to reach 500 replies.</td></tr> </table> <sub>_You can view [your badges on your Steem Board](https://steemitboard.com/@gaottantacinque) and compare to others on the [Steem Ranking](https://steemitboard.com/ranking/index.php?name=gaottantacinque)_</sub> <sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub> ###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) to get one more award and increased upvotes!
author | steemitboard |
---|---|
permlink | steemitboard-notify-gaottantacinque-20200124t194829000z |
category | steemit |
json_metadata | {"image":["https://steemitboard.com/img/notify.png"]} |
created | 2020-01-24 19:48:30 |
last_update | 2020-01-24 19:48:30 |
depth | 1 |
children | 0 |
last_payout | 2020-01-31 19:48:30 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 870 |
author_reputation | 38,975,615,169,260 |
root_title | "Here is how you can easily get a Steemit account Resource Credit amount programmatically" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 94,735,412 |
net_rshares | 0 |
3.27 USD has been spent to promote this content using [Steemium](https://steemium.com/?ref=here-is-how-you-can-easily-get-a-steemit-account-resource-credit-amount-programmatically) . <br> Learn more [here!](https://steemit.com/steem/@steemium/annoucing-steemium-steem-promotion-made-easy-cheap-and-intelligent)
author | steemium | ||||||
---|---|---|---|---|---|---|---|
permlink | steemium-comment-re-gaottantacinque-here-is-how-you-can-easily-get-a-steemit-account-resource-credit-amount-programmatically-20200125t062445547z | ||||||
category | steemit | ||||||
json_metadata | {"app":"steemium"} | ||||||
created | 2020-01-25 06:24:45 | ||||||
last_update | 2020-01-25 06:24:45 | ||||||
depth | 1 | ||||||
children | 0 | ||||||
last_payout | 2020-02-01 06:24:45 | ||||||
cashout_time | 1969-12-31 23:59:59 | ||||||
total_payout_value | 0.000 HBD | ||||||
curator_payout_value | 0.000 HBD | ||||||
pending_payout_value | 0.000 HBD | ||||||
promoted | 0.000 HBD | ||||||
body_length | 311 | ||||||
author_reputation | 14,451,205,037,129 | ||||||
root_title | "Here is how you can easily get a Steemit account Resource Credit amount programmatically" | ||||||
beneficiaries |
| ||||||
max_accepted_payout | 1,000,000.000 HBD | ||||||
percent_hbd | 10,000 | ||||||
post_id | 94,746,249 | ||||||
net_rshares | 0 |
[](https://steempeak.com/@steembasicincome) You have been supported by members of the SBI community that follow this [new plan of action](https://steempeak.com/sbi/@tristancarax/re-tristancarax-q4a00w). Thanks for being a part of this awesome community. Keep on doing what you are doing!
author | tristancarax |
---|---|
permlink | re-gaottantacinque-q4qysp |
category | steemit |
json_metadata | {"tags":["steemit"],"app":"steempeak/2.2.8"} |
created | 2020-01-27 03:53:15 |
last_update | 2020-01-27 03:53:15 |
depth | 1 |
children | 0 |
last_payout | 2020-02-03 03:53:15 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 374 |
author_reputation | 53,928,476,951,778 |
root_title | "Here is how you can easily get a Steemit account Resource Credit amount programmatically" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 94,800,326 |
net_rshares | 0 |