Home > other >  Parse the content in the [], the xpath also take less than value [face] qq: 50. GIF [/face]
Parse the content in the [], the xpath also take less than value [face] qq: 50. GIF [/face]

Time:05-24

The import json
The import pprint

The import requests
The import parsel

Params={
'couid', '5350527288',
'type' : '1',
'page_size' : '10',
'page' : '1',
# 'callback' : 'jQuery11',
}
Url='https://tousu.sina.com.cn/api/company/received_complaints'
Headers={' the user-agent ':' Mozilla/5.0 (Windows NT 10.0; Win64; X64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36 Edg/90.0.818.51 '}

Res=requests. Get (url=url, headers=headers, params=params)

Result=res. Json () [' result '] [' data ']
Pprint. Pprint (result)

# # HTML=res. Text string directly using only use regular expressions
# # print (HTML)
# pprint. Pprint (HTML)
# # the selector=parsel. The selector (HTML) to convert the string data type
# lis=selector. Xpath ('//div [@] ')
  • Related