feat: add rand images
@@ -1,6 +1,8 @@
|
|||||||
package http
|
package http
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
"math/rand"
|
||||||
"net/url"
|
"net/url"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -53,7 +55,7 @@ func (ctl *auth) Login(ctx fiber.Ctx, code, state, redirect string) error {
|
|||||||
authUserInfo = &wechat.AuthorizeUserInfo{
|
authUserInfo = &wechat.AuthorizeUserInfo{
|
||||||
City: "",
|
City: "",
|
||||||
Country: "",
|
Country: "",
|
||||||
Headimgurl: "/avatar.jpeg",
|
Headimgurl: fmt.Sprintf("/avatar/%d.jpeg", 1+rand.Intn(79)),
|
||||||
Nickname: "暂未设置昵称",
|
Nickname: "暂未设置昵称",
|
||||||
Openid: token.Openid,
|
Openid: token.Openid,
|
||||||
Privilege: []string{},
|
Privilege: []string{},
|
||||||
|
|||||||
29
frontend/wechat/avatar.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import requests
|
||||||
|
import os
|
||||||
|
|
||||||
|
# 创建保存目录
|
||||||
|
os.makedirs('avatar', exist_ok=True)
|
||||||
|
|
||||||
|
# 设置请求头模拟浏览器访问
|
||||||
|
headers = {
|
||||||
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
|
||||||
|
}
|
||||||
|
|
||||||
|
for id in range(1, 80): # 生成1-79的ID
|
||||||
|
url = f'https://himg.bdimg.com/sys/portrait/hotitem/wildkid/{id}'
|
||||||
|
try:
|
||||||
|
response = requests.get(url, headers=headers, timeout=10)
|
||||||
|
|
||||||
|
if response.status_code == 200:
|
||||||
|
# 检查内容类型是否为图片
|
||||||
|
if 'image' in response.headers.get('Content-Type', ''):
|
||||||
|
with open(f'avatar/{id}.jpeg', 'wb') as f:
|
||||||
|
f.write(response.content)
|
||||||
|
print(f'ID {id} 下载成功')
|
||||||
|
else:
|
||||||
|
print(f'ID {id} 返回非图片内容,已跳过')
|
||||||
|
else:
|
||||||
|
print(f'ID {id} 响应码 {response.status_code},已跳过')
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f'ID {id} 请求失败: {str(e)}')
|
||||||
BIN
frontend/wechat/public/avatar/1.jpeg
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
frontend/wechat/public/avatar/10.jpeg
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
frontend/wechat/public/avatar/11.jpeg
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
frontend/wechat/public/avatar/12.jpeg
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
frontend/wechat/public/avatar/13.jpeg
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
frontend/wechat/public/avatar/14.jpeg
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
frontend/wechat/public/avatar/15.jpeg
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
frontend/wechat/public/avatar/16.jpeg
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
frontend/wechat/public/avatar/17.jpeg
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
frontend/wechat/public/avatar/18.jpeg
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
frontend/wechat/public/avatar/19.jpeg
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
frontend/wechat/public/avatar/2.jpeg
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
frontend/wechat/public/avatar/20.jpeg
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
frontend/wechat/public/avatar/21.jpeg
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
frontend/wechat/public/avatar/22.jpeg
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
frontend/wechat/public/avatar/23.jpeg
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
frontend/wechat/public/avatar/24.jpeg
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
frontend/wechat/public/avatar/25.jpeg
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
frontend/wechat/public/avatar/26.jpeg
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
frontend/wechat/public/avatar/27.jpeg
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
frontend/wechat/public/avatar/28.jpeg
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
frontend/wechat/public/avatar/29.jpeg
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
frontend/wechat/public/avatar/3.jpeg
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
frontend/wechat/public/avatar/30.jpeg
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
frontend/wechat/public/avatar/31.jpeg
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
frontend/wechat/public/avatar/32.jpeg
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
frontend/wechat/public/avatar/33.jpeg
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
frontend/wechat/public/avatar/34.jpeg
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
frontend/wechat/public/avatar/35.jpeg
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
frontend/wechat/public/avatar/36.jpeg
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
frontend/wechat/public/avatar/37.jpeg
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
frontend/wechat/public/avatar/38.jpeg
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
frontend/wechat/public/avatar/39.jpeg
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
frontend/wechat/public/avatar/4.jpeg
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
frontend/wechat/public/avatar/40.jpeg
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
frontend/wechat/public/avatar/41.jpeg
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
frontend/wechat/public/avatar/42.jpeg
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
frontend/wechat/public/avatar/43.jpeg
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
frontend/wechat/public/avatar/44.jpeg
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
frontend/wechat/public/avatar/45.jpeg
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
frontend/wechat/public/avatar/46.jpeg
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
frontend/wechat/public/avatar/47.jpeg
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
frontend/wechat/public/avatar/48.jpeg
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
frontend/wechat/public/avatar/49.jpeg
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
frontend/wechat/public/avatar/5.jpeg
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
frontend/wechat/public/avatar/50.jpeg
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
frontend/wechat/public/avatar/51.jpeg
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
frontend/wechat/public/avatar/52.jpeg
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
frontend/wechat/public/avatar/53.jpeg
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
frontend/wechat/public/avatar/54.jpeg
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
frontend/wechat/public/avatar/55.jpeg
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
frontend/wechat/public/avatar/56.jpeg
Normal file
|
After Width: | Height: | Size: 58 KiB |
BIN
frontend/wechat/public/avatar/57.jpeg
Normal file
|
After Width: | Height: | Size: 59 KiB |
BIN
frontend/wechat/public/avatar/58.jpeg
Normal file
|
After Width: | Height: | Size: 50 KiB |
BIN
frontend/wechat/public/avatar/59.jpeg
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
frontend/wechat/public/avatar/6.jpeg
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
frontend/wechat/public/avatar/60.jpeg
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
frontend/wechat/public/avatar/61.jpeg
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
frontend/wechat/public/avatar/62.jpeg
Normal file
|
After Width: | Height: | Size: 9.8 KiB |
BIN
frontend/wechat/public/avatar/63.jpeg
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
frontend/wechat/public/avatar/64.jpeg
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
frontend/wechat/public/avatar/65.jpeg
Normal file
|
After Width: | Height: | Size: 35 KiB |
BIN
frontend/wechat/public/avatar/66.jpeg
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
frontend/wechat/public/avatar/67.jpeg
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
frontend/wechat/public/avatar/68.jpeg
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
frontend/wechat/public/avatar/69.jpeg
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
frontend/wechat/public/avatar/7.jpeg
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
frontend/wechat/public/avatar/70.jpeg
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
frontend/wechat/public/avatar/71.jpeg
Normal file
|
After Width: | Height: | Size: 9.8 KiB |
BIN
frontend/wechat/public/avatar/72.jpeg
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
frontend/wechat/public/avatar/73.jpeg
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
frontend/wechat/public/avatar/74.jpeg
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
frontend/wechat/public/avatar/75.jpeg
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
frontend/wechat/public/avatar/76.jpeg
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
frontend/wechat/public/avatar/77.jpeg
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
frontend/wechat/public/avatar/78.jpeg
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
frontend/wechat/public/avatar/79.jpeg
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
frontend/wechat/public/avatar/8.jpeg
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
frontend/wechat/public/avatar/9.jpeg
Normal file
|
After Width: | Height: | Size: 16 KiB |