Last active
July 23, 2018 10:58
-
-
Save 0xIslamTaha/7465add2bc350ecdb0b8e1d51157251a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
FARMER_UNDER_MONITOR = ['mazraa', 'xtremx'] | |
FARMER_RESULTS = {} | |
for famerer in FARMER_UNDER_MONITOR: | |
nodes_info = {} | |
for page_no in range(1000): | |
page_url = "https://capacity.threefoldtoken.com/?cru=0&page={}&country=0&sru=0&farmer={}&mru=0&hru=0".format(page_no, famerer) | |
response = requests.get(page_url) | |
if response.status != 200: | |
break | |
soup = BeautifulSoup(response.content, 'html.parser') | |
table = soup.find_all("tr", { "class" : "nodeItem"}) | |
for row in table: | |
colums = row.findAll("td") | |
node_id=colums[0].find(text=True) | |
status=colums[4] | |
status_new=status.find(text='up' or 'down') | |
node_info[node_id] = {'status': status_new} | |
FARMER_RESULTS[famerer] = nodes_info | |
print(FARMER_RESULTS) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment