8000 sign works well · codepongo/utocode@a402484 · GitHub
[go: up one dir, main page]

Skip to content

Commit a402484

Browse files
committed
sign works well
1 parent b820f7e commit a402484

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

signinzimuzutv/signinzimuzutv.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
import urllib2
55
import sys
66
import json
7-
7+
import os
8+
cookie_file = 'cookie.txt'
89
def login(email, password):
9-
cookie = cookielib.LWPCookieJar('cookie.txt')
10+
cookie = cookielib.LWPCookieJar(cookie_file)
1011
opener = poster.streaminghttp.register_openers()
1112
opener.add_handler(urllib2.HTTPCookieProcessor(cookie))
1213

@@ -21,6 +22,8 @@ def login(email, password):
2122
return json.loads(rep)['info']
2223
def sign():
2324
req = urllib2.Request('http://www.zimuzu.tv/user/sign')
25+
req.add_header('Referer', 'http://www.zimuzu.tv/user/sign')
26+
req.add_header('Host', 'www.zimuzu.tv')
2427
rep = urllib2.urlopen(req).read()
2528
start = rep.find('<div class="a2 tc">')
2629
end = rep.find('<div class="a2 tc"><span class="f2">')
@@ -37,3 +40,4 @@ def logout():
3740
print login(sys.argv[1], sys.argv[2])
3841
print sign()
3942
print logout()
43+
os.remove(os.path.join(os.path.split(os.path.realpath(__file__))[0], cookie_file))

0 commit comments

Comments
 (0)
0