Skip to content

Instantly share code, notes, and snippets.

@nishnik
Created April 13, 2017 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nishnik/6ac7bb64e15d8d18d860c1564753b021 to your computer and use it in GitHub Desktop.
Save nishnik/6ac7bb64e15d8d18d860c1564753b021 to your computer and use it in GitHub Desktop.
Scrapes scores from MetaKGP's "Contribution Scores" page
from bs4 import BeautifulSoup
import requests
data_list = []
link = "https://wiki.metakgp.org/w/Special:ContributionScores"
response = requests.get(link)
html = response.content
source = BeautifulSoup(html, "lxml")
trs = source.findAll("tr")
run = False
for tr in trs:
try:
print (len(tr))
if len(tr) == 6:
if (not run):
run = True
continue
else:
break
if (not(len(tr) == 7)):
continue
td = tr.findAll("td")[4]
print (td)
data_list.append([td.a["href"], td.a.text])
except Exception as e:
print (e, tr)
print (data_list[0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment