Created
April 18, 2014 10:58
-
-
Save taida957789/11037747 to your computer and use it in GitHub Desktop.
Auto Post to Google form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-*- coding: utf-8 -*- | |
import os,sys | |
import http | |
import re | |
import ast | |
import json | |
import datetime | |
import time | |
#隊名 | |
team = "XXXXX" | |
#組員 | |
member = "王曉明1000000 王大明10022323\n王三名1023123 王四名12312313\n...." | |
#組長 | |
captain = "XXXX101*****" | |
#組長電話 | |
phone = "*******" | |
print u"*****************報名系統**************" | |
print "Version: 2.0" | |
print "Author : taida957789" | |
print "***************************************" | |
print "Captain: " + captain | |
print "Members: " | |
for i in member.split("\n"): | |
print i.decode("UTF-8"); | |
ids =[] | |
reqs = [] | |
for i in range(0,10): | |
reqs.append(http.HttpRequest()) | |
page = reqs[i].get('https://docs.google.com/forms/d/1uYy9sbY3NdA9_b6YXhxLjCW3K4-eMO8YJHCrIeJffi4/viewform') | |
resid = re.search('name="fbzx" value="(.*)">',page).group(1) | |
ids.append(resid) | |
print 'Loading:'+ "."*i | |
h = datetime.datetime.now().hour | |
m = datetime.datetime.now().minute | |
s = datetime.datetime.now().second | |
while ( not ( h == 23 and m == 59 and s >= 58 )): | |
h = datetime.datetime.now().hour | |
m = datetime.datetime.now().minute | |
s = datetime.datetime.now().second | |
time.sleep(0.05) | |
os.system('cls' if os.name == 'nt' else 'clear') | |
print(u"倒數 "+ str((23-h)*60*60 + (59-m)*60 + (60-s)) + "s") | |
for i in range(0,10): | |
payload = { | |
'entry.1875787614' : team, | |
'entry.1668039068' : captain, | |
'entry.579607896' : phone, | |
'entry.1050678455' : member , | |
'draftResponse':'[,,"'+str(ids[i])+'"]', | |
'pageHistory' : '0', | |
'fromEmail':'false', | |
'fbzx':str(ids[i]) | |
} | |
reqs[i].addheader([('referer'\ | |
,'https://docs.google.com/forms/d/1uYy9sbY3NdA9_b6YXhxLjCW3K4-eMO8YJHCrIeJffi4/viewform?fbzx='+str(ids[i]))]) | |
page = reqs[i].post('https://docs.google.com/forms/d/1uYy9sbY3NdA9_b6YXhxLjCW3K4-eMO8YJHCrIeJffi4/formResponse',payload) | |
if( re.search('ss-confirmation',page) != None): | |
print 'Success -' + str(ids[i]) | |
else: | |
print 'Failure -' + str(ids[i]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment