From 29fea63d2e675b630ca25fffc5b387183649a8ca Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Mon, 22 Jun 2026 20:53:06 +0800 Subject: [PATCH] chore: add useful local files --- guanghuice-nginx.conf | 44 +++++++++++++++++++++++++++++++++++++++++++ tools/bili_search.py | 23 ++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 guanghuice-nginx.conf create mode 100644 tools/bili_search.py diff --git a/guanghuice-nginx.conf b/guanghuice-nginx.conf new file mode 100644 index 0000000..9807d69 --- /dev/null +++ b/guanghuice-nginx.conf @@ -0,0 +1,44 @@ +server { + server_name guanghuice.com; + + location / { + proxy_pass http://127.0.0.1:3000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } + + location /code/ { + proxy_pass http://127.0.0.1:3002/; + proxy_set_header Host $host; + } + + location /fanqie/ { + proxy_pass http://127.0.0.1:3916/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } + + location /orders/ { + proxy_pass http://127.0.0.1:3920/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + } + + location /api/ { + proxy_pass http://193.112.126.174:3915/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + + listen 443 ssl; + ssl_certificate /etc/letsencrypt/live/guanghuice.com/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/guanghuice.com/privkey.pem; + include /etc/letsencrypt/options-ssl-nginx.conf; +} +server { + if ($host = guanghuice.com) { return 301 https://$host$request_uri; } + listen 80; + server_name guanghuice.com; + return 404; +} diff --git a/tools/bili_search.py b/tools/bili_search.py new file mode 100644 index 0000000..6dc08c7 --- /dev/null +++ b/tools/bili_search.py @@ -0,0 +1,23 @@ +"""B站短剧搜索 - 公开API""" +import requests, json + +url = 'https://api.bilibili.com/x/web-interface/search/type' +params = {'search_type': 'video', 'keyword': '短剧', 'page': 1} +headers = { + 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36', + 'Referer': 'https://www.bilibili.com/' +} + +r = requests.get(url, params=params, headers=headers, timeout=15) +data = r.json() + +if data.get('code') == 0: + results = data.get('data', {}).get('result', []) + print(f'找到 {len(results)} 条结果') + for i, v in enumerate(results[:8], 1): + title = v.get('title', '').replace('', '').replace('', '') + print(f'{i}. [{v.get("play",0)}播放] {title[:60]}') + print(f' UP: {v.get("author","")} | 时长: {v.get("duration","")}') + print() +else: + print(f'API错误: {data}')