File tree 1 file changed +6
-2
lines changed 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 4
4
import urllib2
5
5
import sys
6
6
import json
7
-
7
+ import os
8
+ cookie_file = 'cookie.txt'
8
9
def login (email , password ):
9
- cookie = cookielib .LWPCookieJar ('cookie.txt' )
10
+ cookie = cookielib .LWPCookieJar (cookie_file )
10
11
opener = poster .streaminghttp .register_openers ()
11
12
opener .add_handler (urllib2 .HTTPCookieProcessor (cookie ))
12
13
@@ -21,6 +22,8 @@ def login(email, password):
21
22
return json .loads (rep )['info' ]
22
23
def sign ():
23
24
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' )
24
27
rep = urllib2 .urlopen (req ).read ()
25
28
start = rep .find ('<div class="a2 tc">' )
26
29
end = rep .find ('<div class="a2 tc"><span class="f2">' )
@@ -37,3 +40,4 @@ def logout():
37
40
print login (sys .argv [1 ], sys .argv [2 ])
38
41
print sign ()
39
42
print logout ()
43
+ os .remove (os .path .join (os .path .split (os .path .realpath (__file__ ))[0 ], cookie_file ))
You can’t perform that action at this time.
0 commit comments