MOCHET [7] 
18.07.2018 22:21
 0просмотров 2 0

arc_scanner.py

scanner v1.0.1

import sys
import time
import urllib2

# http://daily.heroeswm.ru/bu.php?i=rbw1lvip
# %h%p/%n%[gameid:.php.gameid=:::].%t

# 83565888_83665888.txt

if len(sys.argv) < 3:
    sys.exit(1)

MIN_ID = int(sys.argv[1]) # 83565888 # + 100.000
MAX_ID = int(sys.argv[2]) # 83665888

BASE_URL = "http://www.lordswm.com/cardsgame.php?action=getnicks&lchatid=99999999999999999999999999999999&gameid="
PARTS_LEN = 36

for id in xrange(MIN_ID, MAX_ID):
    out = str(id) + "\t" + str(int(time.time())) + "\t"
    try:
        contents = urllib2.urlopen(BASE_URL+str(id)).read()
        if "ERROR: undefined game id" != contents:
            parts = contents.split("|")
            name1, id1 = parts[0].split("#")
            name2, id2 = parts[1].split("#")
            res = [name1, id1, name2, id2] + parts[2:]
            out += "\t".join(res)
        else:
            out += "\t".join(["n"]*PARTS_LEN) # no game
    except:
        out += "\t".join(["e"]*PARTS_LEN) # error
    print out


scanner v1.0.0
import sys
import time
import urllib2

if len(sys.argv) < 3:
    sys.exit(1)

MIN_ID = int(sys.argv[1])
MAX_ID = int(sys.argv[2])

BASE_URL = "http://www.lordswm.com/cardsgame.php?action=getnicks&lchatid=99999999999999999999999999999999&gameid="
PARTS_LEN = 36

for id in xrange(MIN_ID, MAX_ID):
    out = str(id) + "\t" + str(int(time.time())) + "\t"
    try:
        contents = urllib2.urlopen(BASE_URL+str(id)).read()
        if "error" not in contents.lower():
            parts = contents.split("|")
            name1, id1 = parts[0].split("#")
            name2, id2 = parts[1].split("#")
            res = [name1, id1, name2, id2] + parts[2:]
            out += "\t".join(res)
        else:
            out += "\t".join(["n"]*PARTS_LEN) # no game
    except:
        out += "\t".join(["e"]*PARTS_LEN) # error
    print out

Возможность комментировать доступна после регистрации