Making a script to get updates when your voting power is 100% Part 01
I am working on building an app that sends the user a message when their voting power is 100%
@trostparadox gave me an idea that it would be great if we could notify a user on when we have 100% voting power again. I came up with so far 2 different methods. Web-scraping and hive data.
Method 1: Web-scraping
If you are new to hive you might now be familiar with a website called hivestats. If you type in
This website will display many different statistics about your account. One of these stats is your hive power.
In the image below you can see there are different dividers in this ginormous html code. Using beautifulsoup4 we can get the url and parse the html to have all the different html components to sort through.
The code is something like this:
python import requests from bs4 import BeautifulSoup r = requests.get("https://hivestats.io/@armoredbanana") soup = BeautifulSoup(r.content, 'html.parser') print(soup.prettify())
As you can see this outputs the parsed html, but it ends at the div with id spawn.
On other web pages, if you scrape them, the amount of parsed html displayed is quite more. And as you can see from the image above, our information is within this root divider, but somehow we cannot access it as of right now.
For example if you run this code
python import requests from bs4 import BeautifulSoup r = requests.get("https://hivestats.io/@armoredbanana") soup = BeautifulSoup(r.content, 'html.parser') #print(soup.prettify()) s = soup.find('div', id = 'root') x = s.find_all('div') print(x)
our code outputs:
Method 2: hive blockchain data
The second method I am looking into is can I get data through the hive blockchain. Hivestats.io gets their data somehow, we just need to figure out how!
Thank you for reading and Part 2 will come soon!