xiaoxiaofuli

APK–API

[] [centos_shell]
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 28 15:52:59 2018
@author: root
"""
import requests
import time
import datetime
import re
import random
headers = {
'Accept-Language': 'zh-CN,zh;q=0.8',
'Host': 'www.js.baidu.com.ylgsrnzxlxpyb9cenfdfef6g.com',
'Accept-Encoding': 'gzip',
'cookie': '__cfduid=dbc9ff34639e222aa9cc0eb395de4d41b1539066777',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:46.0) Gecko/20100101 Firefox/46.0',
}
def get_page(url):
try:
response = requests.get(url, headers=headers)
if response.status_code == 200:
return response.json()
except requests.ConnectionError as e:
print('Error', e.args)

if __name__ == '__main__':
page = 0
while (1):
url = "http://www.js.baidu.com.ylgsrnzxlxpyb9cenfdfef6g.com/api/public/?service=Video.getNearby&uid=-1&lng=0.0&lat=0.0&p=" + str(page)
# print(url)
time.sleep(random.randint(1,10))
json_dict = get_page(url)
print(page)
page = page + 1
# print(json_dict)
items = json_dict['data']['info']
for item in items:
uid = item['uid']
href = item['href']
with open("urlaaaaa.txt", 'a+') as f:
f.write(href)
continue

文章目录
|