Hello,
Christmas is tomorrow, but it's been decided to post it today
The staff tries to always do something special for EZ every christmas, this year was a tough one, but all in all it seemed like a good thing, EZ is striving!. The gift was done by Daxda and me.
This year it is something personal. Seeing how bluechill stirred the whole thing about avatars being "
personal faces on the web" discussion, and many people agreed.
We thought it would be a very nice gesture to make something out of those personal faces of the web, as a thanks to the whole community of active (and not so active) members. If you had at least few posts AND had an avatar, you should find yourself in there
And here it is, the gift!:
http://i.imgur.com/jCNY9yK.jpgWhole project:
http://upload.evilzone.org/download.php?id=4556409&type=zipScripts used for the project:
'''
Script that extracts nickname and profile link
from sensitive data cluster that is available to the admins.
Data file is not included, fuck you.
'''
import re
DATA_FILE = "data.txt"
OUTPUT_FILE = "output.txt"
CHECK_BY = "profile"
URL_RE_PATTERN = "http://evilzone.org/profile/\?u=\d+"
NAME_RE_PATTERN = "\">.+?</a>"
inF = open(DATA_FILE, "r")
outF = open(OUTPUT_FILE, "w")
passed = False
finalStr = ""
counter = 0
for line in inF:
if ((CHECK_BY in line) and passed):
passed = False
counter += 1
nameMatchObj = re.search(NAME_RE_PATTERN, line)
urlMatchObj = re.search(URL_RE_PATTERN, line)
if ((urlMatchObj != None) and (nameMatchObj != None)):
finalStr = "%d;%s;%s" % (counter,
nameMatchObj.group(0).replace("\">", "").replace("</a>", ""),
urlMatchObj.group(0))
outF.write(finalStr+"\n")
print finalStr+"\n"
else:
passed = True
inF.close()
outF.close()
'''
Author: Kulverstukas
Website: http://9v.lt
Date: 2013.12.08
Description:
This script is part of a project for 2013 Evilzone christmas.
What it does is gathers user's avatars and downloads them.
'''
import os
import re
import urllib
import urllib2
#=== CONSTANTS ===
AVATAR_FOLDER = "EZ_Avatars"
INPUT_FILE = "output.txt"
AVATAR_RE = "<img class=\"avatar\".+?/>"
DEFAULT_EXT = "png"
#=================
def readAndStructure():
print "========= STRUCTURING THE FILE ========="
finalArr = []
with open(INPUT_FILE, "r") as f:
for line in f:
dataArr = line.strip().split(";")
finalArr.append(dataArr)
return finalArr
#=================
def grabAvatars(dataArr):
print "========= GRABBING AVATARS ========="
for item in dataArr:
print "Retrieving avatar for "+item[1]
try:
urllib.urlretrieve(item[2], "%s/%s - %s.%s" % (AVATAR_FOLDER, item[0], item[1], DEFAULT_EXT))
except:
print "*** Failed retrieving. Continuing..."
#=================
def extractAvatarUrl(dataArr):
print "========= EXTRACTING AVATAR URLs ========="
finalArr = []
tmpArr = []
for item in dataArr:
tmpArr = []
resp = urllib2.urlopen(item[2])
html = resp.read()
avatarUrlMatchObj = re.search(AVATAR_RE, html)
if (avatarUrlMatchObj != None):
tmpArr.append(item[0])
tmpArr.append(item[1])
tmpArr.append(avatarUrlMatchObj.group(0)
.replace("<img class=\"avatar\" src=\"", "")
.replace("\" alt=\"\" />", "")
.replace("\" width=\"100\" height=\"100", ""))
finalArr.append(tmpArr)
else:
print "No avatar found for "+item[1]
# break;
return finalArr
#=================
def main():
if (os.path.exists(AVATAR_FOLDER) == False):
os.mkdir(AVATAR_FOLDER)
dataArr = readAndStructure()
dataArr = extractAvatarUrl(dataArr)
grabAvatars(dataArr)
#=================
main()