Penalize servers trying to spoof the player count on the Byond page.

This commit is contained in:
A. Svensson 2015-04-06 14:02:24 +02:00
parent 097eba7b03
commit 178a3a33ad

View File

@ -126,12 +126,18 @@ class ServerScraper(object):
def _parse_server_data(self, data): def _parse_server_data(self, data):
'''Parse the individual parts of each server.''' '''Parse the individual parts of each server.'''
if len(self.PLAYERS.findall(data.text)) > 1:
# HACK: If a server tries to spoof the player count by showing
# some extra text matching the PLAYERS pattern (ie. in the
# server title), we give them The Boot.
return
try: try:
title = data.find('b').get_text().splitlines()[0].strip().encode('utf-8') title = data.find('b').get_text().splitlines()[0].strip().encode('utf-8')
except AttributeError: except AttributeError:
# HACK: I think this happends because the raw data was incomplete. # HACK: I think this happends because the raw data was incomplete.
# No complete data, no server update. # No complete data, no server update.
return None return
game_url = data.find('span', 'smaller').text.encode('utf-8') game_url = data.find('span', 'smaller').text.encode('utf-8')
tmp = data.find('a') tmp = data.find('a')