Skip to content

Commit 2b645f9

Browse files
committed
ui
1 parent ba9ef5d commit 2b645f9

File tree

9 files changed

+188
-2
lines changed

9 files changed

+188
-2
lines changed

ProjectConfig/.DS_Store

0 Bytes
Binary file not shown.

ProjectConfig/Script/.DS_Store

0 Bytes
Binary file not shown.

ProjectConfig/Script/API/.DS_Store

6 KB
Binary file not shown.
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
#!/usr/bin/python
2+
# coding=utf-8
3+
import sys
4+
import zipfile
5+
import shutil
6+
import os
7+
import os.path
8+
import time
9+
import datetime
10+
import json
11+
import requests
12+
#include common.py
13+
#
14+
o_path = os.getcwd() # 返回当前工作目录
15+
print(o_path)
16+
# sys.path.append(o_path) # 添加自己指定的搜索路径
17+
# 当前工作目录 Common/PythonCreator/ProjectConfig/Script
18+
sys.path.append('../../')
19+
# sys.path.append('./')
20+
21+
dir = os.path.abspath(__file__)
22+
print(dir)
23+
dir = os.path.dirname(dir)
24+
print(dir)
25+
# sys.path.append("..") #把上级目录加入到变量中
26+
sys.path.insert(0,os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
27+
28+
29+
from Common.Common import Common
30+
# from Config import config
31+
from Common import Source
32+
# from Config import adconfig
33+
from Common.File.FileUtil import FileUtil
34+
35+
36+
from Common.Platform import Platform
37+
38+
# https://api.fanyi.baidu.com/product/113
39+
40+
# http://api.fanyi.baidu.com/api/trans/vip/translate?q=apple&from=en&to=zh&appid=2015063000000001&salt=1435660288&sign=f89f9594663708c1605f3d736d01d2d4
41+
42+
43+
import http.client
44+
import hashlib
45+
import urllib
46+
import random
47+
import json
48+
49+
class BaiduFanyi():
50+
51+
driver: None
52+
filepathSmail=""
53+
54+
#构造函数
55+
def __init__(self):
56+
name =""
57+
58+
def GetUrl(self, url):
59+
r = requests.get(url)
60+
return r.content.decode('utf-8',"ignore")
61+
62+
def RunFanyiEnToCN(self,text):
63+
# text = "apple"
64+
# url = "http://api.fanyi.baidu.com/api/trans/vip/translate?q="+text+"&from=en&to=zh&appid=2015063000000001&salt=1435660288&sign=f89f9594663708c1605f3d736d01d2d4"
65+
# print(url)
66+
# str = self.GetUrl(url)
67+
# print(str)
68+
# rootJson = json.loads(str)
69+
# return rootJson["trans_result"][0]["dst"]
70+
# # {"from":"en","to":"zh","trans_result":[{"src":"apple","dst":"\u82f9\u679c"}]}
71+
72+
73+
appid = '20210603000852273' # 填写你的appid
74+
secretKey = 'ciTOLU1ECG4VXxKQtEsJ' # 填写你的密钥
75+
76+
httpClient = None
77+
myurl = '/api/trans/vip/translate'
78+
79+
fromLang = 'en' #原文语种
80+
toLang = 'zh' #译文语种
81+
salt = random.randint(32768, 65536)
82+
# q= 'apple'
83+
q = text
84+
sign = appid + q + str(salt) + secretKey
85+
sign = hashlib.md5(sign.encode()).hexdigest()
86+
myurl = myurl + '?appid=' + appid + '&q=' + urllib.parse.quote(q) + '&from=' + fromLang + '&to=' + toLang + '&salt=' + str(
87+
salt) + '&sign=' + sign
88+
89+
try:
90+
httpClient = http.client.HTTPConnection('api.fanyi.baidu.com')
91+
httpClient.request('GET', myurl)
92+
93+
# response是HTTPResponse对象
94+
response = httpClient.getresponse()
95+
result_all = response.read().decode("utf-8")
96+
result = json.loads(result_all)
97+
print('翻译::')
98+
# print (result)
99+
list = result["trans_result"]
100+
ret = ""
101+
for item in list:
102+
ret = ret +item["dst"]+"\n"
103+
104+
return ret
105+
106+
except Exception as e:
107+
print (e)
108+
finally:
109+
if httpClient:
110+
httpClient.close()
111+
112+
return ""
113+
114+
mainBaiduFanyi = BaiduFanyi()
115+
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/usr/bin/python
2+
# coding=utf-8
3+
import sys
4+
import zipfile
5+
import shutil
6+
import os
7+
import os.path
8+
import time
9+
import datetime
10+
import json
11+
import requests
12+
#include common.py
13+
#
14+
o_path = os.getcwd() # 返回当前工作目录
15+
print(o_path)
16+
# sys.path.append(o_path) # 添加自己指定的搜索路径
17+
# 当前工作目录 Common/PythonCreator/ProjectConfig/Script
18+
sys.path.append('../../')
19+
# sys.path.append('./')
20+
21+
dir = os.path.abspath(__file__)
22+
print(dir)
23+
dir = os.path.dirname(dir)
24+
print(dir)
25+
# sys.path.append("..") #把上级目录加入到变量中
26+
sys.path.insert(0,os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
27+
28+
29+
from Common.Common import Common
30+
# from Config import config
31+
from Common import Source
32+
# from Config import adconfig
33+
from Common.File.FileUtil import FileUtil
34+
35+
36+
from Common.Platform import Platform
37+
38+
# https://www.jianshu.com/p/e18cdb1053d0
39+
# pip3 install pytube
40+
41+
from pytube import YouTube
42+
43+
44+
# Youtube视频下载网站 https://zh.savefrom.net/7/
45+
class YoutubeDownload():
46+
47+
48+
#构造函数
49+
def __init__(self):
50+
name =""
51+
52+
# pytube http://youtu.be/rJ18V_NNq8g --itag=22
53+
54+
# http://youtu.be/rJ18V_NNq8g
55+
def Download(self, url):
56+
print("YoutubeDownload Download url=",url)
57+
url = "http://youtu.be/rJ18V_NNq8g"
58+
# YouTube(url).streams.first().download()
59+
60+
61+
62+
mainYoutubeDownload = YoutubeDownload()
63+
2.37 KB
Binary file not shown.
1.27 KB
Binary file not shown.
0 Bytes
Binary file not shown.

ProjectConfig/Script/SellMyApp/SellMyApp.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@
5050

5151
from Common.File.FileDownload import mainFileDownload
5252
from Apk.ApkTool import mainApkTool
53+
54+
from API.BaiduFanyi import mainBaiduFanyi
55+
from API.YoutubeDownload import mainYoutubeDownload
56+
57+
5358
class SellMyApp():
5459

5560
driver: None
@@ -116,6 +121,7 @@ def GoApp(self,isHD):
116121
pic =li.get_attribute('data-src')
117122
url = pic[2:]
118123
print("video = ",url)
124+
mainYoutubeDownload.Download(url)
119125
else:
120126
pic =li.get_attribute('data-src')
121127
print(pic)
@@ -151,7 +157,9 @@ def GoApp(self,isHD):
151157

152158
strfile = FileUtil.GetFileString(default_xml)
153159
strfile = strfile.replace("_KEY_EN_",description)
154-
strfile = strfile.replace("_KEY_CN_",description)
160+
161+
description_cn = mainBaiduFanyi.RunFanyiEnToCN(description)
162+
strfile = strfile.replace("_KEY_CN_",description_cn)
155163
FileUtil.SaveString2File(strfile,dst_xml)
156164

157165

@@ -260,7 +268,7 @@ def GetDecodeApkOutputDir(self,isHD):
260268

261269
return dirapk+"/ApkDecodeOutput"
262270

263-
def DownloadApkFinish(self,url,isHD):
271+
def DownloadApkFinish(self,isHD):
264272
downloadDir = self.GetSystemDownloadDir()
265273
apk_download = self.GetDownloadFile(downloadDir,".apk")
266274
# copy apk

0 commit comments

Comments
 (0)