diff options
author | B Stack <bgstack15@gmail.com> | 2020-02-10 22:14:59 -0500 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2020-02-10 22:14:59 -0500 |
commit | 105840aeec07ab927bc99adfb79dd1900dab00e0 (patch) | |
tree | 3c8b0c7878f2888b6099365e90ffe40657372573 | |
parent | add python version, and some example wrapper scripts (diff) | |
download | vooblystats-master.tar.gz vooblystats-master.tar.bz2 vooblystats-master.zip |
-rwxr-xr-x | vooblystats.py | 39 | ||||
-rwxr-xr-x | wrap2.sh | 18 |
2 files changed, 45 insertions, 12 deletions
diff --git a/vooblystats.py b/vooblystats.py index b97b3c8..ee39603 100755 --- a/vooblystats.py +++ b/vooblystats.py @@ -147,6 +147,8 @@ def match(soup): if "ladder/" in i.get('href'): match_dict['Ladder'] = i.text + gameid = match_dict["Match Details"].lstrip("#") + #eprint(gameid) return match_dict def player(match, soup): @@ -161,13 +163,36 @@ def player(match, soup): #print(int(''.join(re.findall('[0-9]',i.get('href'))))) player.append([num]) + # new way to extract name, from the alternate text from the images counts = 1 player_counts = 0 + x=0 + found_names = [] + for k in soup.find_all('td'): + #for i in soup.find_all(name='img'): + for i in k.find_all('img'): + #print("FOO",i) + x += 1 + # always need to skip the first two images with alt text + if x > 2: + for j in re.findall("alt=\"[^\"]+\"",str(i)): + name = j.split('"')[1] + #print("investigating",counts," using name ",name) + if "Age of Empires II: The Conquerors" != name and counts < min(9, player_num + 1) and name not in found_names: + #print("found player number",counts," using name ",name) + player_counts += 1 + player[counts].append(name) + found_names.append(name) + counts+=1 + + # get clan tags + # this is not always sufficient to get names, because of gameid 20365401 Tic@voobly + counts = 1 for i in table.find_all('a'): #this is printing out all name if key in i.get('href'): - player_counts += 1 - name = i.contents[0] - player[counts].append(name) + #player_counts += 1 + #name = i.contents[0] + #player[counts].append(name) try: if re.match("^\[.*]$",i.previous_element): player[counts].append(i.previous_element) # clan @@ -461,13 +486,13 @@ def combine(match,player,score,military,economy,tech,society): "PLAYER," + str(gameid) + "," + str(tp["ID"]) + "," + - tp["Name"] + "," + - ts["Color"] + "," + - tp["Clan"] + "," + + str(tp["Name"]) + "," + + str(ts["Color"]) + "," + + str(tp["Clan"]) + "," + str(tp["New rating"]) + "," + str(tp["Change"]) + "," + str(tp["Winbool"]) + "," + - tp["Civilization"] + "," + + str(tp["Civilization"]) + "," + str(ts["Military Score"]) + "," + str(ts["Economy Score"]) + "," + str(ts["Technology Score"]) + "," + @@ -1,15 +1,23 @@ #!/bin/sh -# end value: 21260965 -test -z "${ENDVALUE}" && ENDVALUE=21260965 +# final end value should be near: 21260965 +# run4 end value, to stop right before vm4 loop: +# run8 end value: 21281500 +test -z "${ENDVALUE}" && ENDVALUE=21281500 # run1 start value: 19899000 # run2 start value: 19903845 -test -z "${STARTVALUE}" && STARTVALUE=19903845 +# run3 start value: 20365401 +# run4 start value: 20367770 +# run5 start value: 20369832 +# run6 start value: 20450916 +# run7 start value: 20497306 +# run8 is after vm4 run: 20811621 +test -z "${STARTVALUE}" && STARTVALUE=20811621 -test -z "${LOGFILE}" && LOGFILE=~/dev/vooblystats/files/run2.csv +test -z "${LOGFILE}" && LOGFILE=~/dev/vooblystats/files/run8.csv -echo "" > "${LOGFILE}" +cat /dev/null > "${LOGFILE}" { printf "%s %s\n" "START" "$( date -u "+%FT%TZ" )" ./vooblystats.py --start "${STARTVALUE}" --end "${ENDVALUE}" |