Skip to content

Commit

Permalink
优化一大堆,懒得写commit了,后面补
Browse files Browse the repository at this point in the history
  • Loading branch information
Samiya committed Mar 6, 2024
1 parent 9a3f6f9 commit 9f11a80
Show file tree
Hide file tree
Showing 26 changed files with 254 additions and 234 deletions.
8 changes: 7 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,10 @@
- [ ] 配置文件热重载问题
- [ ] 将监控系统接入telegram bot,以允许随时添加用户配置文件 或者停止用户任务
- [ ] Alpine的一键DD脚本
- [ ] 对于煤炉推送时间不一样的现象 观察它属于哪个排序?
- [ ] 对于煤炉推送时间不一样的现象 观察它属于哪个排序?
- [ ] 煤炉缓存问题 1. 请求链接加时间戳 2. 请求头中的Origin和Accept-Encoding是否有影响
- [ ] https://api.mercari.jp/users/get_profile?user_id=193978404&_user_format=profile 该接口返回email和phone_number,不知是否需要登录才返回?
- [ ] 煤炉过滤器的值,映射
- [ ] paypay和fril的过滤还没对
- [x] 请求链接是否一定要https?
- [ ]
79 changes: 0 additions & 79 deletions bot.py

This file was deleted.

4 changes: 1 addition & 3 deletions common/http_client/async_aiohttp_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
retry,
wait_fixed,
stop_after_attempt,
retry_if_exception_type,
before_sleep_log,
)
retry_if_exception_type)
from loguru import logger


Expand Down
4 changes: 1 addition & 3 deletions common/http_client/async_httpx_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
retry,
wait_fixed,
stop_after_attempt,
retry_if_exception_type,
before_sleep_log,
)
retry_if_exception_type)


# 自定义重试前的回调函数
Expand Down
2 changes: 1 addition & 1 deletion common/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def extract_keyword_from_url(keyword):
query_params = parse_qs(parsed_url.query)

# 检查关键参数并返回相应的值
for key in ["q", "search_word", "query"]:
for key in ["q", "search_word", "query", "keyword"]:
if key in query_params:
# 通常参数是一个列表,返回第一个值
return query_params[key][0]
Expand Down
Empty file removed config/README.md
Empty file.
14 changes: 10 additions & 4 deletions config/example.env
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# 调试模式
# 如果打开,日志打印为则包含文件名和行号的详细日志格式
# DEBUG=True

# 使用的http客户端类型, 默认aiohttp
# 使用的http客户端类型(aiohttp/httpx), 默认使用aiohttp
# HTTP_CLIENT = "aiohttp"

# Http代理
# Http代理,用于煤炉 telegram等中国大陆无法访问的接口使用
# HTTP_PROXY="http://127.0.0.1:7890"

# Telegram BotToken
# 可以定义多个,后缀递增即可
# https://t.me/Samiya310Bot
TELEGRAM_BOT_TOKEN_1=""
# https://t.me/Lihahadear_bot
Expand All @@ -19,12 +21,16 @@ WECOM_CORP_SECRET=""
# 企业微信应用的AgentID
WECOM_AGENT_ID_1=""


# 任你购
# 账号名
RENNIGOU_MAIL = ""
# 密码
RENNIGOU_PASS = ""

# Telegram 反代服务器
TELEGRAM_API_URL = "https://api.telegram.org/bot{0}/{1}"
# 官方接口
# TELEGRAM_API_URL = "https://api.telegram.org/bot{0}/{1}"
# 阿里云新加坡
# TELEGRAM_API_URL = "http://8.222.130.125:8878/bot{0}/{1}"
# Cloudflare反代接口
# TELEGRAM_API_URL = "https://tg.samiya.pro/bot{0}/{1}"
15 changes: 15 additions & 0 deletions config/hoyoyo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# HOYOYO 配置
# 官网: https://cn.hoyoyo.com

# HOYOYO 网站的搜索设置(仅限骏河屋)
[[websites.hoyoyo.searches]]
# 直接将网页上的网址复制即可
# 必填项,str
keyword = "https://cn.hoyoyo.com/suruga~search.html?keyword=%E5%AE%B6%E5%BA%AD%E6%95%99%E5%B8%AB%E3%83%92%E3%83%83%E3%83%88%E3%83%9E%E3%83%B3REBORN&keys=%E5%AE%B6%E5%BA%AD%E6%95%99%E5%B8%AB%E3%83%92%E3%83%83%E3%83%88%E3%83%9E%E3%83%B3REBORN&lang=ja&category_id=&fykeyid=34416"

# 通知方式
# from * to *
# 必填项
# 第一项 @Samiya310Bot(1),@Lihahadear_bot(2),企业微信Samiya(3)
# 第二项 根据notify中填的ids定
notify = [1,1]
8 changes: 6 additions & 2 deletions config/lashinbang.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,9 @@ keyword = "呪術廻戦"
notify = [1,2]

[websites.lashinbang.searches.filter]
# 排序顺序,可选项,默认最新上架
sort = ""
# 排序顺序,可选项,默认関連順
# 関連順 Score,Number18
# 入荷日(降順)Score,Number7
# 更新日(降順) Number7,Score
# 発売日(降順) Number3,Score
sort = ""
12 changes: 7 additions & 5 deletions config/mercari.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ notify = [1,2]
[websites.mercari.searches.filter]
# 排除关键词,可选项
exclude_keyword = ""
# 卖家ID,可选项
sellerId = ""
# 商品状态,可选项,默认为on_sale和trading
status = ""
# 品类,可选项
categoryId = ""
# 品牌,可选项
brandId = ""
# 最低价格,可选项
price_min = ""
# 最高价格,可选项
price_max = ""
# 品类,可选项
category = ""
# 品牌,可选项
brandId = ""
price_max = ""
4 changes: 2 additions & 2 deletions config/mercari_user.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ keyword = '110551852'
notify = [1,2]

[websites.mercari_user.searches.filter]
# 商品状态,可选项,默认为on_sale和trading
status = ""
# 商品状态(on_sale,trading,sold_out),可选项,默认为 (on_sale,trading)
status = "on_sale,trading,sold_out"
6 changes: 3 additions & 3 deletions config/notify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ user = "Default User"
# Telegram 设置
# Telegram用户ID,与企业微信用户ID至少需要一个
# 可通过给 https://t.me/username_to_id_bot 发一条消息来获取
telegram_chat_ids = [123456,789123]
telegram_chat_ids = ["123456","789123"]
# Telegram 消息发送类型
# 可选项:1代表纯文本,2代表文字+图片分开发送,3代表图文一起发送,默认为3
tg_send_type = 3
Expand Down Expand Up @@ -37,13 +37,13 @@ user_max_pages = 20
# 可选项,默认值为 0.049
exchange_rate = 0.049

# 每个搜索任务的最大并发数
# 每个搜索任务的最大并发数,即动态并发搜索的页数
# 可选项,默认值为10
max_concurrency = 10

# 自定义消息推送模板
# 可选项,有默认模板
# 可用参数
# 可用占位符如下:
# id 商品ID
# imageURL 商品图片链接
# productName 商品名
Expand Down
73 changes: 44 additions & 29 deletions config/rennigou.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
keyword = "家庭教師ヒットマンREBORN"

# 搜索网站,必填项
# all, mercari, yahooauction, rakuma, amazon, surugaya
websiteType = "mercari"
# 全部-all, 煤炉-mercari, 雅虎日拍-yahooauction,乐天Rakuma-rakuma,亚马逊Amazon-amazon,骏河屋-surugaya
websiteType = "surugaya"

# 通知方式
# from * to *
Expand All @@ -19,37 +19,52 @@ notify = [1,2]


[websites.rennigou.searches.filter]
# 通用过滤器
# 排序
# mercari 空/推荐排序 price_asc/价格从低到高 price_desc/价格从高到低 new/上架日期从近到远 like_desc/点赞从多到少
# surugaya 空/默认 price_asc/价格从低到高 price_desc/价格从高到低 new_publish/新上架商品 publish_time_asc/发售日从近到远 publish_time_desc/发售日从远到近
sortOrder = "new"

# 价格
priceMin = ""
priceMax = ""

# 煤炉
# 1/仅看有货 空/全部
statusOnSale = ""
# 品相成色 1(新品、未使用)/2(几乎未使用)/3(没有明显的划痕或污垢)/4(有一些划痕和污渍)/5(有划痕和污垢)/6(整体状况不佳) 空/全部
conditionIds = ""
# 2/日本内包邮 空/全部
# >>>>>>>>>>>>>>煤炉过滤器>>>>>>>>>>>>>>>>>>>>>>>
# 推荐排序-为空,价格降序-price_desc,价格升序-price_asc,上架日期从近到远-new,点赞从多到少-like_desc
sortOrder = ""

# 仅看有货-勾选为1,不勾选为空
statusOnSale = "1"

# 仅看现货-勾选为1,不勾选为空
haveStock = "1"

# 日本国内包邮-勾选为2,不勾选为空
shippingPayer = ""

category = ""
brand_ids = ""
# 新品、未使用-1,几乎未使用-2,没有明显的划痕或污垢-3,有一些划痕和污渍-4,有划痕和污垢-5,整体状况不佳-6,全部-空
conditionIds = ""
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

# >>>>>>>>>>>>>>骏河屋过滤器>>>>>>>>>>>>>>>>>>>
# 默认-为空,价格从低到高-price_asc,价格从高到低-price_desc,新上架商品-new_publish,发售日从进到远-publish_time_asc,发售日从远到近-publish_time_desc
sortOrder = ""

# 仅看现货-勾选为1,不勾选为空
haveStock = "1"

# 骏河屋
# 1/仅看现货
haveStock = ""
# 2/新上架
# 新上架-勾选为2,不勾选为空
newPublish = ""

# 折扣 不限为1,后续递增到7,7为>100%
discountId = "1"

# 分类,1029/吧唧
category = ""

# 1/不限 2/新品 3/二手 4/预约
conditionId = ""
# 1/2/3/4/5/6/7
discountId = ""
# 1029/吧唧
category = ""
conditionId = "1"
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


# >>>>>>>>>>>>>>雅虎日拍过滤器>>>>>>>>>>>>>>>>>>>>>
# TODO
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

# >>>>>>>>>>>>>>>Rakuma过滤器>>>>>>>>>>>>>>>>>>>>
# TODO
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

# >>>>>>>>>>>>>>>亚马逊过滤器>>>>>>>>>>>>>>>>>>>>>
# TODO
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3 changes: 1 addition & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ services:
stdin_open: true
tty: true
command: /data -A
# 爬虫
VintageVigil:
image: samiya777/vintagevigil:latest
container_name: vintagevigil
Expand All @@ -24,4 +23,4 @@ services:
max-file: "3"
volumes:
- /root/VintageUser/.env:/root/VintageVigil/.env # 环境变量
- /root/VintageUser/lx:/root/VintageVigil/user/lx # 配置文件
- /root/VintageUser/user:/root/VintageVigil/user/user # 配置文件
Loading

0 comments on commit 9f11a80

Please sign in to comment.