@@ -9,46 +9,48 @@ class ParsingActivator:
9
9
@staticmethod
10
10
def twitter (site , logger , cookies = {}):
11
11
headers = dict (site .headers )
12
- del headers [' x-guest-token' ]
13
- r = requests .post (site .activation [' url' ], headers = headers )
12
+ del headers [" x-guest-token" ]
13
+ r = requests .post (site .activation [" url" ], headers = headers )
14
14
logger .info (r )
15
15
j = r .json ()
16
- guest_token = j [site .activation [' src' ]]
17
- site .headers [' x-guest-token' ] = guest_token
16
+ guest_token = j [site .activation [" src" ]]
17
+ site .headers [" x-guest-token" ] = guest_token
18
18
19
19
@staticmethod
20
20
def vimeo (site , logger , cookies = {}):
21
21
headers = dict (site .headers )
22
- if ' Authorization' in headers :
23
- del headers [' Authorization' ]
24
- r = requests .get (site .activation [' url' ], headers = headers )
25
- jwt_token = r .json ()[' jwt' ]
26
- site .headers [' Authorization' ] = ' jwt ' + jwt_token
22
+ if " Authorization" in headers :
23
+ del headers [" Authorization" ]
24
+ r = requests .get (site .activation [" url" ], headers = headers )
25
+ jwt_token = r .json ()[" jwt" ]
26
+ site .headers [" Authorization" ] = " jwt " + jwt_token
27
27
28
28
@staticmethod
29
29
def spotify (site , logger , cookies = {}):
30
30
headers = dict (site .headers )
31
- if ' Authorization' in headers :
32
- del headers [' Authorization' ]
33
- r = requests .get (site .activation [' url' ])
34
- bearer_token = r .json ()[' accessToken' ]
35
- site .headers [' authorization' ] = f' Bearer { bearer_token } '
31
+ if " Authorization" in headers :
32
+ del headers [" Authorization" ]
33
+ r = requests .get (site .activation [" url" ])
34
+ bearer_token = r .json ()[" accessToken" ]
35
+ site .headers [" authorization" ] = f" Bearer { bearer_token } "
36
36
37
37
@staticmethod
38
38
def xssis (site , logger , cookies = {}):
39
39
if not cookies :
40
- logger .debug (' You must have cookies to activate xss.is parsing!' )
40
+ logger .debug (" You must have cookies to activate xss.is parsing!" )
41
41
return
42
42
43
43
headers = dict (site .headers )
44
44
post_data = {
45
- ' _xfResponseType' : ' json' ,
46
- ' _xfToken' : ' 1611177919,a2710362e45dad9aa1da381e21941a38'
45
+ " _xfResponseType" : " json" ,
46
+ " _xfToken" : " 1611177919,a2710362e45dad9aa1da381e21941a38" ,
47
47
}
48
- headers ['content-type' ] = 'application/x-www-form-urlencoded; charset=UTF-8'
49
- r = requests .post (site .activation ['url' ], headers = headers , cookies = cookies , data = post_data )
50
- csrf = r .json ()['csrf' ]
51
- site .get_params ['_xfToken' ] = csrf
48
+ headers ["content-type" ] = "application/x-www-form-urlencoded; charset=UTF-8"
49
+ r = requests .post (
50
+ site .activation ["url" ], headers = headers , cookies = cookies , data = post_data
51
+ )
52
+ csrf = r .json ()["csrf" ]
53
+ site .get_params ["_xfToken" ] = csrf
52
54
53
55
54
56
async def import_aiohttp_cookies (cookiestxt_filename ):
@@ -62,8 +64,8 @@ async def import_aiohttp_cookies(cookiestxt_filename):
62
64
for key , cookie in list (domain .values ())[0 ].items ():
63
65
c = Morsel ()
64
66
c .set (key , cookie .value , cookie .value )
65
- c [' domain' ] = cookie .domain
66
- c [' path' ] = cookie .path
67
+ c [" domain" ] = cookie .domain
68
+ c [" path" ] = cookie .path
67
69
cookies_list .append ((key , c ))
68
70
69
71
cookies .update_cookies (cookies_list )
0 commit comments