-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppVersionApple.py
More file actions
63 lines (52 loc) · 1.86 KB
/
Copy pathAppVersionApple.py
File metadata and controls
63 lines (52 loc) · 1.86 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import sys
import zipfile
import shutil
import os
import os.path
import json
sys.path.append('../../')
sys.path.append('./')
from Common.File.FileDownload import mainFileDownload
class AppVersionApple():
# https://itunes.apple.com/lookup?id=914391781
# https://itunes.apple.com/cn/lookup?id=914391781
def GetHtml(self,appid):
url = "https://itunes.apple.com/cn/lookup?id="+appid
# # 创建chrome浏览器驱动,无头模式(超爽)
# chrome_options = Options()
# chrome_options.add_argument('--headless')
# self.driver = webdriver.Chrome(chrome_options=chrome_options)
# # 加载百度页面
# self.driver.get(url)
# time.sleep(3)
# # html = self.driver.execute_script("return document.documentElement.outerHTML")
# html = self.driver.page_source
html = mainFileDownload.DownloadData(url)
return html
def ParseVersion(self,appid):
html = self.GetHtml(appid)
rootJson = json.loads(html)
jsonResult = rootJson["results"];
version ="1.0.0"
if len(jsonResult) == 0:
return version
jsonItem = jsonResult[0]
url = jsonItem["trackViewUrl"]
# string key_releaseNotes = "releaseNotes";
# if (Common.JsonDataContainsKey(jsonItem, key_releaseNotes))
# {
# strUpdateNote = (string)jsonItem[key_releaseNotes];
# }
version = jsonItem["version"];
return version
def GetAppName(self,appid):
html = self.GetHtml(appid)
rootJson = json.loads(html)
jsonResult = rootJson["results"];
version =""
if len(jsonResult) == 0:
return version
jsonItem = jsonResult[0]
version = jsonItem["trackName"];
return version
mainAppVersionApple = AppVersionApple()