赞
踩
写在前面:酒店和旅游景点方式不同,不能用我的写法,如果获取酒店数据请参考:https://blog.csdn.net/qq_34774456/article/details/89885296
旅游景点代码(地址要用手机版的携程搜自己想搜的景点):
- import urllib.request
- from bs4 import BeautifulSoup
- import pymysql.cursors
- import requests
- import json
- import datetime
-
-
- def deal_json_invaild(data):
- data = data.replace("\n", "").replace("\r", "").replace("\n\r", "").replace("\r\n", "").replace("\t", "").replace("\\\"","\"").replace(" ","")
-
- data = data.replace('":"{"', "**testPasswors**5")\
- .replace('":"', '&&testPassword&&')\
- .replace('","', "$$testPassword$$")\
- .replace('":{"', "**testPasswors**1")\
- .replace('"},"', "**testPasswors**2")\
- .replace(',"', "**testPasswors**3")\
- .replace('{"', "@@testPassword@@")\
- .replace('"}', "**testPassword**")\
- .replace('":', "**testPasswors**4")\
-
- data = data.replace('"', '”')\
- .replace("**testPasswors**5","\":{\"").replace
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。