Skip to content

Instantly share code, notes, and snippets.

@mobeigi
Created October 21, 2017 05:19
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 mobeigi/84155570d3877707e8e635e522c4003c to your computer and use it in GitHub Desktop.
Save mobeigi/84155570d3877707e8e635e522c4003c to your computer and use it in GitHub Desktop.
Vac Ban Checker (scraper)
#!/usr/bin/env python
import requests, re
from bs4 import BeautifulSoup
num_vac_bans = 0
num_game_bans = 0
num_punished = 0
total = 0
with open('input.txt') as f:
for steamid64 in f:
steamid64 = steamid64.rstrip()
target_page = f"https://steamcommunity.com/profiles/{steamid64}/"
r = requests.get(target_page)
html = r.text
soup = BeautifulSoup(html, "html.parser")
profile_ban_divs = soup.find_all("div", "profile_ban")
for profile_ban in profile_ban_divs:
html_str = str(profile_ban)
if html_str.find('VAC ban on record') != -1 or html_str.find('VAC bans on record') != -1:
num_vac_bans = num_vac_bans + 1
if html_str.find('game ban on record') != -1 or html_str.find('game bans on record') != -1:
num_game_bans = num_game_bans + 1
num_punished = num_punished + 1
total = total + 1
print(f"There was a total of {total} accounts processed. {num_punished} were punished.")
print(f"Breakdown of punishments: {num_vac_bans} were VAC banned. {num_game_bans} were Game Banned.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment