需要把特殊字符替换到才能使用loads方法:

import json
import re
import requests

headers = {
    'authority': 'www.ixigua.com',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36',
    'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
    'cookie': 'MONITOR_WEB_ID=ce7600a7-1408-4fdf-a025-a2edca498529; ttwid=1%7C1qziXR4rgPRdSk9hqE41S7EUfnClVha-Uab_IX4ASHs%7C1632844963%7C957b513101d4e90853a5fbd52c0ebc74ff69b5b5f2015855bc3c89c0a104caee; ixigua-a-s=0',
}

response = requests.get(
    'https://www.ixigua.com/search/100%5E%%5EE5%5E%%5E85%5E%%5E83%5E%%5EE5%5E%%5E90%5E%%5E83%5E%%5EE9%5E%%5E81%5E%%5E8D%5E%%5EE7%5E%%5EBE%5E%%5E8E%5E%%5EE9%5E%%5EA3%5E%%5E9F%5E%%5EE8%5E%%5E8A%5E%%5E82/',
    headers=headers)


pattern = re.compile("_SSR_HYDRATED_DATA=(.*?)</script>")
res = pattern.search(response.text).group(1)
aa = res.replace("\\u002F", "/").replace("\\u003C", "<").replace("\\u003E", ">").replace("\\\"", "'").replace(
    "undefined", "\"\"")

print(json.loads(aa))

 

相关文章:

  • 2022-12-23
  • 2021-10-18
  • 2022-12-23
  • 2021-10-27
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-12
  • 2022-12-23
  • 2021-06-12
  • 2021-08-04
  • 2021-11-24
相关资源
相似解决方案