-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathspider.py
More file actions
28 lines (22 loc) · 788 Bytes
/
spider.py
File metadata and controls
28 lines (22 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import requests
import hashlib
import time
import base64
def get_token(value, offset):
array = []
array.append(value)
array.append('9fdLnciVh4FxQbri')
array.append(str(offset))
timestamp = str(int(time.time()))
array.append(timestamp)
sign = hashlib.sha1(','.join(array).encode('utf-8')).hexdigest()
return base64.b64encode(','.join([sign, timestamp]).encode('utf-8')).decode('utf-8')
INDEX_URL = 'https://app8.scrape.center/api/movie?limit={limit}&offset={offset}&token={token}'
MAX_PAGE = 10
LIMIT = 10
for i in range(MAX_PAGE):
offset = i * LIMIT
token = get_token('/api/movie', offset)
index_url = INDEX_URL.format(limit=LIMIT, offset=offset, token=token)
response = requests.get(index_url)
print('response', response.json())