Skip to content

Commit 30c3268

Browse files
committedJul 31, 2022
feat: add moyu
1 parent 9b5908d commit 30c3268

File tree

4 files changed

+124
-106
lines changed

4 files changed

+124
-106
lines changed
 

‎Script/.qiniu_pythonsdk_hostscache.json

-1
This file was deleted.

‎Script/push_interview_blog.py

-105
This file was deleted.

‎Script/upload_wechat.py

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# -*- coding: utf-8 -*-
2+
from werobot import WeRoBot
3+
import os
4+
import json
5+
import requests
6+
from selenium import webdriver
7+
8+
9+
class WebDriver:
10+
def __init__(self, driver_path):
11+
self.brower = webdriver.Chrome(executable_path=driver_path)
12+
website = self.brower.get("https://whaoa.github.io/markdown-nice/")
13+
page_source = self.brower.page_source
14+
title = self.brower.title
15+
# print(website)
16+
print(page_source)
17+
print(title)
18+
19+
20+
class WeRoBotClint:
21+
22+
def __init__(self):
23+
robot = WeRoBot()
24+
robot.config["APP_ID"] = os.getenv("wx2dfe81f38281cfd9")
25+
robot.config["APP_SECRET"] = os.getenv("ef5e460dd2941f640aa6eaf69b97d1c4")
26+
self.we_client = robot.client
27+
self.we_token = self.we_client.grant_token()
28+
29+
def upload_media(self, media_file):
30+
res_json = self.we_client.upload_permanent_media("image", open(media_file, "rb"))
31+
media_id = res_json["media_id"]
32+
url = res_json["url"]
33+
return media_id
34+
35+
# 因werobot暂未支持,所以直接采用接口访问
36+
def upload_article(self, content):
37+
articles = {
38+
"articles": [
39+
{
40+
"thumb_media_id": "JqgEfa5SNzBYVoHTccyIRsGDDhotpIMnUnwCL2L6pp_JfvIA3qdDBc9kYJmlzGi4",
41+
"author": "zhangferry",
42+
"title": "Happy Day",
43+
"content_source_url": "https://zhangferry.com/2022/07/24/github_action_for_blog_deploy/",
44+
"content": content,
45+
# 图文信息描述
46+
"digest": "描述信息",
47+
"need_open_comment": 1
48+
}
49+
]
50+
}
51+
52+
client = NetworkClint()
53+
token = client.get_access_token()
54+
headers = {'Content-type': 'text/plain; charset=utf-8'}
55+
datas = json.dumps(articles, ensure_ascii=False).encode('utf-8')
56+
postUrl = "https://api.weixin.qq.com/cgi-bin/draft/add?access_token=%s" % token
57+
58+
r = requests.post(postUrl, data=datas, headers=headers)
59+
resp = json.loads(r.text)
60+
print(resp)
61+
62+
63+
class NetworkClint:
64+
def __init__(self):
65+
self.__accessToken = ""
66+
self.__leftTime = 0
67+
68+
def __real_get_access_token(self):
69+
post_url = ("https://api.weixin.qq.com/cgi-bin/token?grant_type="
70+
"client_credential&appid=%s&secret=%s" % (
71+
os.getenv('WECHAT_APP_ID'), os.getenv('WECHAT_APP_SECRET')))
72+
print(post_url)
73+
response = requests.request(method="post", url=post_url)
74+
response_json = json.loads(response.text)
75+
76+
self.__accessToken = response_json["access_token"]
77+
self.__leftTime = response_json["expires_in"]
78+
79+
def get_access_token(self):
80+
if self.__leftTime < 10:
81+
self.__real_get_access_token()
82+
return self.__accessToken
83+
84+
85+
if __name__ == '__main__':
86+
local_path = "/Users/zhangferry/Desktop/wechat_content"
87+
local_img_path = "/Users/zhangferry/Desktop/WechatIMG9.jpeg"
88+
driver_path = "/Users/zhangferry/Developer/chromedriver"
89+
90+
driver = WebDriver(driver_path)
91+
92+
# os.environ['WECHAT_APP_ID'] = ""
93+
# os.environ['WECHAT_APP_SECRET'] = ""
94+
# with open(local_path, "r") as fp:
95+
# file_content = fp.read()
96+
# print(file_content)
97+
#
98+
# clinet = WeRoBotClint()
99+
# # res = clinet.upload_media(local_img_path)
100+
# # print(res)
101+
# clinet.upload_article(file_content)
102+
103+
104+
temp_token = "59_FzaJlr22Qak-Sd4XNnXGjUprHTp7xaDQV_RDv8BRpal_-TyEPyaYUlWNpLHAvJxYpZoPqtpMb-1nMzV6ZuJDVFi8QwMYJz88SKE86U-SNX_wDPiOpwaZ6D8O9UXOuR0aEjYh3rIBk4NDe8LVNFIaAGADVY"

‎WeeklyLearning/iOSWeeklyLearning_63_process.md

+20
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,27 @@
2626

2727
## 摸一下鱼
2828

29+
现在的网页功能是非常强,不只是各种各样的应用,现在很多操作系统都搬到了网页上,本期内容会推荐几个在线的操作系统,虽然不知真的操作系统,但作为预览,功能还是很丰富的。
2930

31+
1、[win11在线体验](https://win11.blueedge.me/ "win 11 在线体验"):该项目使用React实现的,代码地址:https://github.com/blueedgetechno/win11React
32+
33+
![](https://cdn.zhangferry.com/Images/20220731124759.png)
34+
35+
2、[操作系统风格的博客](goodmanwen.github.io):这是一个 Blog 项目,该 Blog 的主题是模拟 Linux 桌面主题中的 Deepin distro。其本质是一个托管在 Github Page 上的博客,你也可以配置一个这样酷酷的主题。
36+
37+
![](https://cdn.zhangferry.com/Images/20220731130051.png)
38+
39+
3、[dustinbrett.com](dustinbrett.com):一个模拟 Windows 的网站,也可以把它理解成一个作者的个人网站。这里面还集成了一个毁灭战士早期的版本,你可以在这个网站里玩它。
40+
41+
![](https://cdn.zhangferry.com/Images/20220731143028.png)
42+
43+
4、[copy/v86](https://copy.sh/v86/):在浏览器中运行 x86 操作系统,这个模拟跟前面提到的 H5 技术不同,它是采用 WebAssembly 把原来的 x86 OS 代码转成 wasm 在线上运行的,更贴近「真」操作系统。
44+
45+
![](https://cdn.zhangferry.com/Images/20220731150332.png)
46+
47+
这个是远程运行的 Windows 98 系统:
48+
49+
![](https://cdn.zhangferry.com/Images/20220731145541.png)
3050

3151
## 岗位推荐
3252

0 commit comments

Comments
 (0)
Please sign in to comment.