mirror of
https://github.com/tgbot-collection/YYeTsBot.git
synced 2025-11-24 19:12:53 +08:00
更换域名
This commit is contained in:
2
.github/workflows/release_apps.yaml
vendored
2
.github/workflows/release_apps.yaml
vendored
@@ -49,7 +49,7 @@ jobs:
|
||||
GENERATE_SOURCEMAP: ${{ secrets.GENERATE_SOURCEMAP }}
|
||||
run: |
|
||||
bash scripts/pre_build.sh
|
||||
echo "REACT_APP_TAURI=https://yyets.dmesg.app" >> YYeTsFE/.env
|
||||
echo "REACT_APP_TAURI=https://yyets.click" >> YYeTsFE/.env
|
||||
|
||||
- name: Install yarn
|
||||
run: |
|
||||
|
||||
@@ -157,9 +157,9 @@ python /path/to/YYeTsBot/yyetsbot/bot.py
|
||||
|
||||
如果无法访问Telegram,可以使用如下网址下载数据
|
||||
|
||||
* [网站实时数据,MongoDB](https://yyets.dmesg.app/data/yyets_mongo.gz)
|
||||
* [MySQL](https://yyets.dmesg.app/data/yyets_mysql.zip)
|
||||
* [SQLite](https://yyets.dmesg.app/data/yyets_sqlite.zip)
|
||||
* [网站实时数据,MongoDB](https://yyets.click/data/yyets_mongo.gz)
|
||||
* [MySQL](https://yyets.click/data/yyets_mysql.zip)
|
||||
* [SQLite](https://yyets.click/data/yyets_sqlite.zip)
|
||||
|
||||
# API 文档
|
||||
|
||||
|
||||
10
README.md
10
README.md
@@ -5,7 +5,7 @@
|
||||
|
||||
* 人人影视bot,[戳我使用](https://t.me/yyets_bot)
|
||||
|
||||
* 人人影视分享站,[戳我使用](https://yyets.dmesg.app/)
|
||||
* 人人影视分享站,[戳我使用](https://yyets.click/)
|
||||
|
||||
机器人和网站由我长期维护,如果遇到问题可以提issue。
|
||||
|
||||
@@ -95,7 +95,7 @@ yyets_offline - 人人影视离线数据
|
||||
|
||||
## 在线 原生应用程序
|
||||
|
||||
使用tauri封装的网页。内容等同于 `https://yyets.dmesg.app`,只不过是原生的App。使用方法如下
|
||||
使用tauri封装的网页。内容等同于 `https://yyets.click`,只不过是原生的App。使用方法如下
|
||||
|
||||
1. 请到 [GitHub Release](https://github.com/tgbot-collection/YYeTsBot/releases) ,找最新的 `YYeTsBot App`
|
||||
2. windows下载msi,macos下载dmg或tar.gz,Linux下载AppImage或deb(Debian based)
|
||||
@@ -116,9 +116,9 @@ yyets_offline - 人人影视离线数据
|
||||
```
|
||||
>>> from yyets import YYeTs
|
||||
>>> yy=YYeTs("逃避")
|
||||
[2021-09-21 19:22:32 __init__.py:54 I] Fetching 逃避可耻却有用...https://yyets.dmesg.app/api/resource?id=34812
|
||||
[2021-09-21 19:22:33 __init__.py:54 I] Fetching 无法逃避...https://yyets.dmesg.app/api/resource?id=29540
|
||||
[2021-09-21 19:22:35 __init__.py:54 I] Fetching 逃避者...https://yyets.dmesg.app/api/resource?id=37089
|
||||
[2021-09-21 19:22:32 __init__.py:54 I] Fetching 逃避可耻却有用...https://yyets.click/api/resource?id=34812
|
||||
[2021-09-21 19:22:33 __init__.py:54 I] Fetching 无法逃避...https://yyets.click/api/resource?id=29540
|
||||
[2021-09-21 19:22:35 __init__.py:54 I] Fetching 逃避者...https://yyets.click/api/resource?id=37089
|
||||
|
||||
>>> yy.result
|
||||
[<yyets.Resource object at 0x10cc7b130>, <yyets.Resource object at 0x10ca0e880>, <yyets.Resource object at 0x10cc7b040>]
|
||||
|
||||
@@ -8,7 +8,7 @@ pymongo==4.4.1
|
||||
tornado==6.3.2
|
||||
captcha==0.4
|
||||
passlib==1.7.4
|
||||
fakeredis==2.16.0
|
||||
fakeredis==2.17.0
|
||||
filetype==1.2.0
|
||||
requests[socks]
|
||||
tqdm==4.65.0
|
||||
|
||||
@@ -31,7 +31,7 @@ function import_db() {
|
||||
docker-compose up -d mongo
|
||||
|
||||
echo "[4/5] 正在下载并导入数据库"
|
||||
curl -o /tmp/yyets_mongo.gz https://yyets.dmesg.app/dump/yyets_mongo.gz
|
||||
curl -o /tmp/yyets_mongo.gz https://yyets.click/dump/yyets_mongo.gz
|
||||
file /tmp/yyets_mongo.gz
|
||||
docker cp /tmp/yyets_mongo.gz yyets_mongo_1:/tmp
|
||||
# special for windows
|
||||
|
||||
2
setup.py
2
setup.py
@@ -13,7 +13,7 @@ from setuptools import Command, setup
|
||||
|
||||
# Package meta-data.
|
||||
NAME = "yyets"
|
||||
DESCRIPTION = "https://yyets.dmesg.app/ wrapper"
|
||||
DESCRIPTION = "https://yyets.click/ wrapper"
|
||||
URL = "https://github.com/tgbot-collection/YYeTsBot"
|
||||
EMAIL = "benny.think@gmail.com"
|
||||
AUTHOR = "BennyThink"
|
||||
|
||||
@@ -7,10 +7,11 @@
|
||||
|
||||
__author__ = "Benny <benny.think@gmail.com>"
|
||||
|
||||
import requests
|
||||
import logging
|
||||
|
||||
API = "https://yyets.dmesg.app/api/resource?"
|
||||
import requests
|
||||
|
||||
API = "https://yyets.click/api/resource?"
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
|
||||
@@ -14,19 +14,20 @@ import requests
|
||||
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||
from telethon import TelegramClient, events
|
||||
|
||||
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(filename)s [%(levelname)s]: %(message)s')
|
||||
logging.getLogger('apscheduler.executors.default').propagate = False
|
||||
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(filename)s [%(levelname)s]: %(message)s")
|
||||
logging.getLogger("apscheduler.executors.default").propagate = False
|
||||
api_id = int(os.environ.get("API_ID") or "3")
|
||||
api_hash = os.environ.get("API_HASH") or "4"
|
||||
bot_name = os.environ.get("BOT_NAME") or "yyets_bot"
|
||||
bot_token = os.environ.get("BOT_token") or "123"
|
||||
|
||||
client = TelegramClient('client-hc', api_id, api_hash,
|
||||
device_model="Benny-health-check", system_version="89", app_version="1.0.0")
|
||||
client = TelegramClient(
|
||||
"client-hc", api_id, api_hash, device_model="Benny-health-check", system_version="89", app_version="1.0.0"
|
||||
)
|
||||
check_status = []
|
||||
|
||||
|
||||
@client.on(events.NewMessage(incoming=True, pattern='(?i).*欢迎使用,直接发送想要的剧集标题给我就可以了.*', from_users=bot_name))
|
||||
@client.on(events.NewMessage(incoming=True, pattern="(?i).*欢迎使用,直接发送想要的剧集标题给我就可以了.*", from_users=bot_name))
|
||||
async def my_event_handler(event):
|
||||
logging.info("Okay it's working %s", event)
|
||||
check_status.clear()
|
||||
@@ -37,7 +38,7 @@ async def send_health_check():
|
||||
# restart it
|
||||
await bot_warning()
|
||||
else:
|
||||
await client.send_message(bot_name, '/start')
|
||||
await client.send_message(bot_name, "/start")
|
||||
check_status.append("check")
|
||||
|
||||
|
||||
@@ -50,8 +51,8 @@ async def bot_warning():
|
||||
|
||||
|
||||
async def website_check():
|
||||
home = "https://yyets.dmesg.app/"
|
||||
top = "https://yyets.dmesg.app/api/top"
|
||||
home = "https://yyets.click/"
|
||||
top = "https://yyets.click/api/top"
|
||||
message = ""
|
||||
try:
|
||||
resp1 = requests.get(home)
|
||||
@@ -75,10 +76,10 @@ async def website_check():
|
||||
logging.info("It's working home: %s bytes; top: %s bytes", len(resp1.content), len(resp2.content))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
scheduler = AsyncIOScheduler()
|
||||
scheduler.add_job(send_health_check, 'interval', seconds=300)
|
||||
scheduler.add_job(website_check, 'interval', seconds=60)
|
||||
scheduler.add_job(send_health_check, "interval", seconds=300)
|
||||
scheduler.add_job(website_check, "interval", seconds=60)
|
||||
scheduler.start()
|
||||
client.start()
|
||||
client.run_until_disconnected()
|
||||
|
||||
@@ -20,7 +20,7 @@ logger = logging.getLogger()
|
||||
logger.addHandler(handler)
|
||||
logger.setLevel(logging.INFO)
|
||||
|
||||
URL = "https://yyets.dmesg.app/api/top"
|
||||
URL = "https://yyets.click/api/top"
|
||||
# URL = "https://www.baidu.com/"
|
||||
req = requests.get(URL)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const baseURL = "https://yyets.dmesg.app/";
|
||||
const baseURL = "https://yyets.click/";
|
||||
const resourceURL = baseURL + "resource.html?id=";
|
||||
const indexURL = baseURL + "?id=index";
|
||||
|
||||
@@ -61,4 +61,4 @@ function reloadIndex() {
|
||||
console.error(xhr);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ async function handleEvent(event) {
|
||||
return new Response(value, {
|
||||
headers: {
|
||||
"content-type": "application/json;charset=UTF-8",
|
||||
"Access-Control-Allow-Origin": "https://yyets.dmesg.app"
|
||||
"Access-Control-Allow-Origin": "https://yyets.click"
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -26,9 +26,9 @@ FIX_SEARCH = "http://www.zimuxia.cn/?s={kw}"
|
||||
ZHUIXINFAN_SEARCH = "http://www.fanxinzhui.com/list?k={}"
|
||||
ZHUIXINFAN_RESOURCE = "http://www.fanxinzhui.com{}"
|
||||
# yyets website
|
||||
DOMAIN = "https://yyets.dmesg.app/"
|
||||
DOMAIN = "https://yyets.click/"
|
||||
WORKERS = f"{DOMAIN}resource?id=" + "{}"
|
||||
# https://yyets.dmesg.app/discuss#6464d5b1b27861fa44647e7e
|
||||
# https://yyets.click/discuss#6464d5b1b27861fa44647e7e
|
||||
DISCUSS = f"{DOMAIN}discuss#" + "{}"
|
||||
# new zmz
|
||||
NEWZMZ_SEARCH = "https://newzmz.com/subres/index/getres.html?keyword={}"
|
||||
|
||||
@@ -230,8 +230,8 @@ class YYeTsOffline(BaseFansub):
|
||||
def search_result(self, resource_url) -> dict:
|
||||
# yyets offline
|
||||
|
||||
# resource: https://yyets.dmesg.app/resource.html?id=37089
|
||||
# comment: 'https://yyets.dmesg.app/resource.html?id=233#61893ae51e9152e43fa24124'
|
||||
# resource: https://yyets.click/resource.html?id=37089
|
||||
# comment: 'https://yyets.click/resource.html?id=233#61893ae51e9152e43fa24124'
|
||||
if "#" in resource_url:
|
||||
cid = resource_url.split("#")[1]
|
||||
data: dict = self.db["comment"].find_one(
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# YYeTsBot - bot.py
|
||||
# 2019/8/15 18:27
|
||||
|
||||
__author__ = 'Benny <benny.think@gmail.com>'
|
||||
__author__ = "Benny <benny.think@gmail.com>"
|
||||
|
||||
import io
|
||||
import json
|
||||
@@ -21,43 +21,50 @@ from telebot import apihelper, types
|
||||
from tgbot_ping import get_runtime
|
||||
|
||||
import fansub
|
||||
from config import (DOMAIN, FANSUB_ORDER, MAINTAINER, PROXY, REPORT, TOKEN,
|
||||
YYETS_SEARCH_URL)
|
||||
from utils import (get_error_dump, redis_announcement, reset_request,
|
||||
save_error_dump, show_usage, today_request)
|
||||
from config import DOMAIN, FANSUB_ORDER, MAINTAINER, PROXY, REPORT, TOKEN, YYETS_SEARCH_URL
|
||||
from utils import get_error_dump, redis_announcement, reset_request, save_error_dump, show_usage, today_request
|
||||
|
||||
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(filename)s [%(levelname)s]: %(message)s')
|
||||
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(filename)s [%(levelname)s]: %(message)s")
|
||||
if PROXY:
|
||||
apihelper.proxy = {'https': PROXY}
|
||||
apihelper.proxy = {"https": PROXY}
|
||||
|
||||
bot = telebot.TeleBot(TOKEN, num_threads=100)
|
||||
angry_count = 0
|
||||
|
||||
|
||||
@bot.message_handler(commands=['start'], chat_types=['private'])
|
||||
@bot.message_handler(commands=["start"], chat_types=["private"])
|
||||
def send_welcome(message):
|
||||
bot.send_chat_action(message.chat.id, 'typing')
|
||||
bot.send_message(message.chat.id, '欢迎使用,直接发送想要的剧集标题给我就可以了,不需要其他关键字,我会帮你搜索。\n\n'
|
||||
'仅私聊使用,群组功能已禁用。'
|
||||
f'目前搜索优先级 {FANSUB_ORDER}\n '
|
||||
f'另外,可以尝试使用一下 https://yyets.dmesg.app/ 哦!',
|
||||
parse_mode='html', disable_web_page_preview=True)
|
||||
bot.send_chat_action(message.chat.id, "typing")
|
||||
bot.send_message(
|
||||
message.chat.id,
|
||||
"欢迎使用,直接发送想要的剧集标题给我就可以了,不需要其他关键字,我会帮你搜索。\n\n"
|
||||
"仅私聊使用,群组功能已禁用。"
|
||||
f"目前搜索优先级 {FANSUB_ORDER}\n "
|
||||
f"另外,可以尝试使用一下 https://yyets.click/ 哦!",
|
||||
parse_mode="html",
|
||||
disable_web_page_preview=True,
|
||||
)
|
||||
|
||||
|
||||
@bot.message_handler(commands=['help'], chat_types=['private'])
|
||||
@bot.message_handler(commands=["help"], chat_types=["private"])
|
||||
def send_help(message):
|
||||
bot.send_chat_action(message.chat.id, 'typing')
|
||||
bot.send_message(message.chat.id, '''机器人无法使用或者报错?从 /ping 里可以看到运行状态以及最新信息。
|
||||
bot.send_chat_action(message.chat.id, "typing")
|
||||
bot.send_message(
|
||||
message.chat.id,
|
||||
"""机器人无法使用或者报错?从 /ping 里可以看到运行状态以及最新信息。
|
||||
同时,你可以使用如下方式寻求使用帮助和报告错误:\n
|
||||
1. @BennyThink
|
||||
2. <a href='https://github.com/BennyThink/YYeTsBot/issues'>Github issues</a>
|
||||
3. <a href='https://t.me/mikuri520'>Telegram Channel</a>''', parse_mode='html', disable_web_page_preview=True)
|
||||
3. <a href='https://t.me/mikuri520'>Telegram Channel</a>""",
|
||||
parse_mode="html",
|
||||
disable_web_page_preview=True,
|
||||
)
|
||||
|
||||
|
||||
@bot.message_handler(commands=['ping'], chat_types=['private'])
|
||||
@bot.message_handler(commands=["ping"], chat_types=["private"])
|
||||
def send_ping(message):
|
||||
logging.info("Pong!")
|
||||
bot.send_chat_action(message.chat.id, 'typing')
|
||||
bot.send_chat_action(message.chat.id, "typing")
|
||||
|
||||
info = get_runtime("botsrunner_yyets_1")
|
||||
|
||||
@@ -67,11 +74,10 @@ def send_ping(message):
|
||||
announcement = redis_announcement() or ""
|
||||
if announcement:
|
||||
announcement = f"\n\n*公告:{announcement}*\n\n"
|
||||
bot.send_message(message.chat.id, f"{info}\n\n{usage}\n{announcement}",
|
||||
parse_mode='markdown')
|
||||
bot.send_message(message.chat.id, f"{info}\n\n{usage}\n{announcement}", parse_mode="markdown")
|
||||
|
||||
|
||||
@bot.message_handler(commands=['settings'], chat_types=['private'])
|
||||
@bot.message_handler(commands=["settings"], chat_types=["private"])
|
||||
def settings(message):
|
||||
is_admin = str(message.chat.id) == MAINTAINER
|
||||
# 普通用户只可以查看,不可以设置。
|
||||
@@ -101,39 +107,43 @@ def settings(message):
|
||||
|
||||
@bot.callback_query_handler(func=lambda call: re.findall(r"announcement(\S*)", call.data))
|
||||
def delete_announcement(call):
|
||||
bot.send_chat_action(call.message.chat.id, 'typing')
|
||||
bot.send_chat_action(call.message.chat.id, "typing")
|
||||
redis_announcement(op="del")
|
||||
|
||||
bot.edit_message_text(f"目前公告:\n\n {redis_announcement() or '暂无公告'}",
|
||||
call.message.chat.id,
|
||||
call.message.message_id)
|
||||
bot.edit_message_text(f"目前公告:\n\n {redis_announcement() or '暂无公告'}", call.message.chat.id, call.message.message_id)
|
||||
|
||||
|
||||
@bot.message_handler(commands=['credits'], chat_types=['private'])
|
||||
@bot.message_handler(commands=["credits"], chat_types=["private"])
|
||||
def send_credits(message):
|
||||
bot.send_chat_action(message.chat.id, 'typing')
|
||||
bot.send_message(message.chat.id, '''感谢字幕组的无私奉献!本机器人资源来源:\n
|
||||
bot.send_chat_action(message.chat.id, "typing")
|
||||
bot.send_message(
|
||||
message.chat.id,
|
||||
"""感谢字幕组的无私奉献!本机器人资源来源:\n
|
||||
<a href="http://www.zmz2019.com/">人人影视</a>
|
||||
<a href="http://cili001.com/">磁力下载站</a>
|
||||
<a href="http://www.zhuixinfan.com/main.php">追新番</a>
|
||||
<a href="https://www.zimuxia.cn/">FIX 字幕侠</a>
|
||||
''', parse_mode='html', disable_web_page_preview=True)
|
||||
""",
|
||||
parse_mode="html",
|
||||
disable_web_page_preview=True,
|
||||
)
|
||||
|
||||
|
||||
for sub_name in dir(fansub):
|
||||
if sub_name.endswith("_offline") or sub_name.endswith("_online"):
|
||||
@bot.message_handler(commands=[sub_name], chat_types=['private'])
|
||||
|
||||
@bot.message_handler(commands=[sub_name], chat_types=["private"])
|
||||
def varies_fansub(message):
|
||||
bot.send_chat_action(message.chat.id, 'typing')
|
||||
bot.send_chat_action(message.chat.id, "typing")
|
||||
# /YYeTsOffline 逃避可耻 /YYeTsOffline
|
||||
tv_name: str = re.findall(r"/.*line\s*(\S*)", message.text)[0]
|
||||
class_name: str = re.findall(r"/(.*line)", message.text)[0]
|
||||
class_ = getattr(fansub, class_name)
|
||||
|
||||
if not tv_name:
|
||||
bot.send_message(message.chat.id,
|
||||
f"{class_.__name__}: 请附加你要搜索的剧集名称,如 `/{class_name} 逃避可耻`",
|
||||
parse_mode='markdown')
|
||||
bot.send_message(
|
||||
message.chat.id, f"{class_.__name__}: 请附加你要搜索的剧集名称,如 `/{class_name} 逃避可耻`", parse_mode="markdown"
|
||||
)
|
||||
return
|
||||
|
||||
else:
|
||||
@@ -154,16 +164,16 @@ def download_to_io(photo):
|
||||
|
||||
|
||||
def send_my_response(message):
|
||||
bot.send_chat_action(message.chat.id, 'record_video_note')
|
||||
bot.send_chat_action(message.chat.id, "record_video_note")
|
||||
# I may also send picture
|
||||
photo = message.photo
|
||||
uid = message.reply_to_message.caption
|
||||
text = f"主人说:{message.text or message.caption or '啥也没说😯'}"
|
||||
if photo:
|
||||
bot.send_chat_action(message.chat.id, 'typing')
|
||||
bot.send_chat_action(message.chat.id, "typing")
|
||||
logging.info("Photo received from maintainer")
|
||||
mem = download_to_io(photo)
|
||||
mem.name = f'{uid}.jpg'
|
||||
mem.name = f"{uid}.jpg"
|
||||
r = bot.send_photo(uid, mem.getvalue(), caption=text)
|
||||
else:
|
||||
r = bot.send_message(uid, text)
|
||||
@@ -176,7 +186,7 @@ def send_my_response(message):
|
||||
logging.info("Forward has been deleted.")
|
||||
|
||||
|
||||
@bot.message_handler(content_types=["photo", "text"], chat_types=['private'])
|
||||
@bot.message_handler(content_types=["photo", "text"], chat_types=["private"])
|
||||
def send_search(message):
|
||||
if str(message.chat.id) == os.getenv("SPECIAL_ID") and message.text == "❤️":
|
||||
bot.reply_to(message, "❤️")
|
||||
@@ -187,7 +197,7 @@ def send_search(message):
|
||||
base_send_search(message)
|
||||
|
||||
|
||||
@bot.message_handler(content_types=["document"], chat_types=['private'])
|
||||
@bot.message_handler(content_types=["document"], chat_types=["private"])
|
||||
def ban_user(message):
|
||||
if str(message.chat.id) != MAINTAINER:
|
||||
return
|
||||
@@ -220,20 +230,24 @@ def base_send_search(message, instance=None):
|
||||
fan = fansub.FansubEntrance()
|
||||
else:
|
||||
fan = instance
|
||||
bot.send_chat_action(message.chat.id, 'typing')
|
||||
bot.send_chat_action(message.chat.id, "typing")
|
||||
|
||||
today_request("total")
|
||||
if message.reply_to_message and message.reply_to_message.document and \
|
||||
message.reply_to_message.document.file_name.startswith("error") and str(message.chat.id) == MAINTAINER:
|
||||
if (
|
||||
message.reply_to_message
|
||||
and message.reply_to_message.document
|
||||
and message.reply_to_message.document.file_name.startswith("error")
|
||||
and str(message.chat.id) == MAINTAINER
|
||||
):
|
||||
today_request("answer")
|
||||
send_my_response(message)
|
||||
return
|
||||
|
||||
name = zhconv.convert(message.text, "zh-hans")
|
||||
logging.info('Receiving message: %s from user %s(%s)', name, message.chat.username, message.chat.id)
|
||||
logging.info("Receiving message: %s from user %s(%s)", name, message.chat.username, message.chat.id)
|
||||
if name is None:
|
||||
today_request("invalid")
|
||||
with open('warning.webp', 'rb') as sti:
|
||||
with open("warning.webp", "rb") as sti:
|
||||
bot.send_message(message.chat.id, "不要调戏我!我会报警的")
|
||||
bot.send_sticker(message.chat.id, sti)
|
||||
return
|
||||
@@ -256,25 +270,34 @@ def base_send_search(message, instance=None):
|
||||
if result:
|
||||
logging.info("🎉 Resource match.")
|
||||
today_request("success")
|
||||
bot.reply_to(message, f"{warning}呐🌹,一共%d个结果,选一个呀!来源:%s" % (len(result), source),
|
||||
reply_markup=markup, parse_mode="markdown")
|
||||
bot.reply_to(
|
||||
message,
|
||||
f"{warning}呐🌹,一共%d个结果,选一个呀!来源:%s" % (len(result), source),
|
||||
reply_markup=markup,
|
||||
parse_mode="markdown",
|
||||
)
|
||||
else:
|
||||
logging.warning("⚠️️ Resource not found")
|
||||
today_request("fail")
|
||||
bot.send_chat_action(message.chat.id, 'typing')
|
||||
bot.send_chat_action(message.chat.id, "typing")
|
||||
|
||||
encoded = quote_plus(name)
|
||||
bot.reply_to(message, f"没有找到你想要的信息,是不是你打了错别字,或者搜索了一些国产影视剧。🤪\n"
|
||||
f"还是你想调戏我哦🙅 本小可爱拒绝被调戏️\n\n"
|
||||
"⚠️如果确定要我背锅,那么请使用 /help 来提交错误", disable_web_page_preview=True)
|
||||
bot.reply_to(
|
||||
message,
|
||||
f"没有找到你想要的信息,是不是你打了错别字,或者搜索了一些国产影视剧。🤪\n" f"还是你想调戏我哦🙅 本小可爱拒绝被调戏️\n\n" "⚠️如果确定要我背锅,那么请使用 /help 来提交错误",
|
||||
disable_web_page_preview=True,
|
||||
)
|
||||
if REPORT:
|
||||
btn = types.InlineKeyboardButton("快来修复啦", callback_data="fix")
|
||||
markup.add(btn)
|
||||
bot.send_chat_action(message.chat.id, 'upload_document')
|
||||
bot.send_message(message.chat.id, f"《{name}》😭\n大部分情况下机器人是好用的,不要怀疑我的代码质量.\n"
|
||||
f"如果你真的确定是机器人出问题了,那么点下面的按钮叫 @BennyThink 来修!\n"
|
||||
f"⚠️报错前请三思,不要乱点,确保这锅应该甩给我。否则我会很生气的😡小心被拉黑哦",
|
||||
reply_markup=markup)
|
||||
bot.send_chat_action(message.chat.id, "upload_document")
|
||||
bot.send_message(
|
||||
message.chat.id,
|
||||
f"《{name}》😭\n大部分情况下机器人是好用的,不要怀疑我的代码质量.\n"
|
||||
f"如果你真的确定是机器人出问题了,那么点下面的按钮叫 @BennyThink 来修!\n"
|
||||
f"⚠️报错前请三思,不要乱点,确保这锅应该甩给我。否则我会很生气的😡小心被拉黑哦",
|
||||
reply_markup=markup,
|
||||
)
|
||||
content = f""" 报告者:{message.chat.first_name}{message.chat.last_name or ""}@{message.chat.username or ""}({message.chat.id})
|
||||
问题发生时间:{time.strftime("%Y-%m-%data %H:%M:%S", time.localtime(message.date))}
|
||||
请求内容:{name}
|
||||
@@ -297,15 +320,15 @@ def magic_recycle(fan, call, url_hash):
|
||||
@bot.callback_query_handler(func=lambda call: re.findall(r"choose(\S*)", call.data))
|
||||
def choose_link(call):
|
||||
fan = fansub.FansubEntrance()
|
||||
bot.send_chat_action(call.message.chat.id, 'typing')
|
||||
bot.send_chat_action(call.message.chat.id, "typing")
|
||||
# call.data is url_hash, with sha1, http://www.rrys2020.com/resource/36588
|
||||
resource_url_hash = re.findall(r"choose(\S*)", call.data)[0]
|
||||
if magic_recycle(fan, call, resource_url_hash):
|
||||
return
|
||||
|
||||
result = fan.search_result(resource_url_hash)
|
||||
with tempfile.NamedTemporaryFile(mode='wb+', prefix=result["cnname"].replace("/", " "), suffix=".txt") as tmp:
|
||||
bytes_data = json.dumps(result["all"], ensure_ascii=False, indent=4).encode('u8')
|
||||
with tempfile.NamedTemporaryFile(mode="wb+", prefix=result["cnname"].replace("/", " "), suffix=".txt") as tmp:
|
||||
bytes_data = json.dumps(result["all"], ensure_ascii=False, indent=4).encode("u8")
|
||||
tmp.write(bytes_data)
|
||||
tmp.flush()
|
||||
with open(tmp.name, "rb") as f:
|
||||
@@ -313,31 +336,25 @@ def choose_link(call):
|
||||
caption = "{}\n\n{}".format(result["cnname"], result["share"])
|
||||
else:
|
||||
caption = result["all"].replace(r"\n", " ")
|
||||
bot.send_chat_action(call.message.chat.id, 'upload_document')
|
||||
bot.send_chat_action(call.message.chat.id, "upload_document")
|
||||
bot.send_document(call.message.chat.id, f, caption=caption)
|
||||
|
||||
|
||||
@bot.callback_query_handler(func=lambda call: re.findall(r"approve", call.data))
|
||||
def approve_spam(call):
|
||||
obj_id = re.findall(r"approve(\S*)", call.data)[0]
|
||||
data = {
|
||||
"obj_id": obj_id,
|
||||
"token": TOKEN
|
||||
}
|
||||
data = {"obj_id": obj_id, "token": TOKEN}
|
||||
requests.post(f"{DOMAIN}api/admin/spam", json=data)
|
||||
bot.answer_callback_query(call.id, 'Approved')
|
||||
bot.answer_callback_query(call.id, "Approved")
|
||||
bot.delete_message(call.message.chat.id, call.message.message_id)
|
||||
|
||||
|
||||
@bot.callback_query_handler(func=lambda call: re.findall(r"ban", call.data))
|
||||
def ban_spam(call):
|
||||
obj_id = re.findall(r"ban(\S*)", call.data)[0]
|
||||
data = {
|
||||
"obj_id": obj_id,
|
||||
"token": TOKEN
|
||||
}
|
||||
data = {"obj_id": obj_id, "token": TOKEN}
|
||||
requests.delete(f"{DOMAIN}api/admin/spam", json=data)
|
||||
bot.answer_callback_query(call.id, 'Banned')
|
||||
bot.answer_callback_query(call.id, "Banned")
|
||||
bot.delete_message(call.message.chat.id, call.message.message_id)
|
||||
|
||||
|
||||
@@ -346,7 +363,7 @@ def send_unwelcome(call):
|
||||
# this will come from me only
|
||||
logging.warning("I'm so unhappy!")
|
||||
message = call.message
|
||||
bot.send_chat_action(message.chat.id, 'typing')
|
||||
bot.send_chat_action(message.chat.id, "typing")
|
||||
|
||||
# angry_count = angry_count + 1
|
||||
global angry_count
|
||||
@@ -354,23 +371,21 @@ def send_unwelcome(call):
|
||||
uid = re.findall(r"unwelcome(\d*)", call.data)[0]
|
||||
|
||||
if uid:
|
||||
text = "人人影视主要提供欧美日韩等海外资源,你的这个真没有🤷。\n" \
|
||||
"<b>麻烦你先从自己身上找原因</b>,我又不是你的专属客服。\n" \
|
||||
"不要再报告这种错误了🙄️,面倒な。😡"
|
||||
text = "人人影视主要提供欧美日韩等海外资源,你的这个真没有🤷。\n" "<b>麻烦你先从自己身上找原因</b>,我又不是你的专属客服。\n" "不要再报告这种错误了🙄️,面倒な。😡"
|
||||
bot.send_message(uid, text, parse_mode="html")
|
||||
bot.reply_to(message, f"有生之日 生气次数:{angry_count}")
|
||||
|
||||
|
||||
@bot.callback_query_handler(func=lambda call: call.data == 'fix')
|
||||
@bot.callback_query_handler(func=lambda call: call.data == "fix")
|
||||
def report_error(call):
|
||||
logging.error("Reporting error to maintainer.")
|
||||
bot.send_chat_action(call.message.chat.id, 'typing')
|
||||
bot.send_chat_action(call.message.chat.id, "typing")
|
||||
error_content = get_error_dump(call.message.chat.id)
|
||||
if error_content == "":
|
||||
bot.answer_callback_query(call.id, '多次汇报重复的问题并不会加快处理速度。', show_alert=True)
|
||||
bot.answer_callback_query(call.id, "多次汇报重复的问题并不会加快处理速度。", show_alert=True)
|
||||
return
|
||||
|
||||
text = f'人人影视机器人似乎出现了一些问题🤔🤔🤔……{error_content[0:300]}'
|
||||
text = f"人人影视机器人似乎出现了一些问题🤔🤔🤔……{error_content[0:300]}"
|
||||
|
||||
markup = types.InlineKeyboardMarkup()
|
||||
btn = types.InlineKeyboardButton("unwelcome", callback_data=f"unwelcome{call.message.chat.id}")
|
||||
@@ -378,20 +393,20 @@ def report_error(call):
|
||||
|
||||
bot.send_message(MAINTAINER, text, disable_web_page_preview=True, reply_markup=markup)
|
||||
|
||||
with tempfile.NamedTemporaryFile(mode='wb+', prefix=f"error_{call.message.chat.id}_", suffix=".txt") as tmp:
|
||||
tmp.write(error_content.encode('u8'))
|
||||
with tempfile.NamedTemporaryFile(mode="wb+", prefix=f"error_{call.message.chat.id}_", suffix=".txt") as tmp:
|
||||
tmp.write(error_content.encode("u8"))
|
||||
tmp.flush()
|
||||
|
||||
with open(tmp.name, "rb") as f:
|
||||
bot.send_chat_action(call.message.chat.id, 'upload_document')
|
||||
bot.send_chat_action(call.message.chat.id, "upload_document")
|
||||
bot.send_document(MAINTAINER, f, caption=str(call.message.chat.id))
|
||||
|
||||
bot.answer_callback_query(call.id, 'Debug信息已经发送给维护者,请耐心等待回复~', show_alert=True)
|
||||
bot.answer_callback_query(call.id, "Debug信息已经发送给维护者,请耐心等待回复~", show_alert=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
logging.info('YYeTs bot is running...')
|
||||
if __name__ == "__main__":
|
||||
logging.info("YYeTs bot is running...")
|
||||
scheduler = BackgroundScheduler()
|
||||
scheduler.add_job(reset_request, 'cron', hour=0, minute=0)
|
||||
scheduler.add_job(reset_request, "cron", hour=0, minute=0)
|
||||
scheduler.start()
|
||||
bot.polling()
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
# 导入数据
|
||||
|
||||
从 [这里](https://yyets.dmesg.app/database) 下载mongodb数据,然后导入
|
||||
从 [这里](https://yyets.click/database) 下载mongodb数据,然后导入
|
||||
|
||||
```shell
|
||||
mongorestore --gzip --archive=yyets_mongo.gz --nsFrom "share.*" --nsTo "zimuzu.*"
|
||||
|
||||
@@ -98,7 +98,7 @@ def check_spam(ip, ua, author, content) -> int:
|
||||
return 0
|
||||
if token:
|
||||
with contextlib.suppress(Exception):
|
||||
akismet = Akismet(token, blog="https://yyets.dmesg.app/")
|
||||
akismet = Akismet(token, blog="https://yyets.click/")
|
||||
|
||||
return akismet.check(
|
||||
ip,
|
||||
|
||||
@@ -222,9 +222,9 @@ class Comment(Mongo):
|
||||
# send email
|
||||
parent_comment = self.db["comment"].find_one({"_id": ObjectId(parent_comment_id)})
|
||||
if resource_id == 233:
|
||||
link = f"https://yyets.dmesg.app/discuss#{parent_comment_id}"
|
||||
link = f"https://yyets.click/discuss#{parent_comment_id}"
|
||||
else:
|
||||
link = f"https://yyets.dmesg.app/resource?id={resource_id}#{parent_comment_id}"
|
||||
link = f"https://yyets.click/resource?id={resource_id}#{parent_comment_id}"
|
||||
user_info = self.db["users"].find_one({"username": parent_comment["username"], "email.verified": True})
|
||||
if user_info:
|
||||
subject = "[人人影视下载分享站] 你的评论有了新的回复"
|
||||
|
||||
@@ -129,7 +129,7 @@ func announcement(c *gin.Context) {
|
||||
"data": []Announcement{{
|
||||
Username: "Benny",
|
||||
Date: buildTime,
|
||||
Content: "YYeTs一键运行包 https://yyets.dmesg.app/。",
|
||||
Content: "YYeTs一键运行包 https://yyets.click/。",
|
||||
}},
|
||||
})
|
||||
}
|
||||
@@ -156,7 +156,7 @@ func douban(c *gin.Context) {
|
||||
if doubanInfo == "" {
|
||||
var image Image
|
||||
log.Warnf("Douban resource not found, requesting to main site ...")
|
||||
resp, _ := http.Get("https://yyets.dmesg.app" + c.Request.URL.String())
|
||||
resp, _ := http.Get("https://yyets.click" + c.Request.URL.String())
|
||||
body, _ := io.ReadAll(resp.Body)
|
||||
doubanInfo = string(body)
|
||||
json.Unmarshal(body, &image)
|
||||
@@ -216,7 +216,7 @@ func downloadDB() {
|
||||
}
|
||||
|
||||
log.Infoln("Downloading database file...")
|
||||
var downloadUrl = "https://yyets.dmesg.app/dump/yyets_sqlite.zip"
|
||||
var downloadUrl = "https://yyets.click/dump/yyets_sqlite.zip"
|
||||
resp, _ := http.Get(downloadUrl)
|
||||
file, _ := os.Create("yyets_sqlite.zip")
|
||||
_, _ = io.Copy(file, resp.Body)
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
</head>
|
||||
<body style="background-color: #f6f6f6; font-family: sans-serif; -webkit-font-smoothing: antialiased; font-size: 14px; line-height: 1.4; margin: 0; padding: 0; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;">
|
||||
<span class="preheader"
|
||||
style="color: transparent; display: none; height: 0; max-height: 0; max-width: 0; opacity: 0; overflow: hidden; mso-hide: all; visibility: hidden; width: 0;">人人影视分享站 https://yyets.dmesg.app/ </span>
|
||||
style="color: transparent; display: none; height: 0; max-height: 0; max-width: 0; opacity: 0; overflow: hidden; mso-hide: all; visibility: hidden; width: 0;">人人影视分享站 https://yyets.click/ </span>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="body"
|
||||
style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; background-color: #f6f6f6; width: 100%;"
|
||||
width="100%" bgcolor="#f6f6f6">
|
||||
@@ -153,13 +153,13 @@
|
||||
<td class="content-block"
|
||||
style="font-family: sans-serif; vertical-align: top; padding-bottom: 10px; padding-top: 10px; color: #999999; font-size: 12px; text-align: center;"
|
||||
valign="top" align="center">
|
||||
<a href="https://yyets.dmesg.app"><span class="apple-link"
|
||||
<a href="https://yyets.click"><span class="apple-link"
|
||||
style="color: #999999; font-size: 12px; text-align: center;">
|
||||
人人影视下载分享站</span></a>
|
||||
|
||||
<span class="apple-link"
|
||||
style="color: #999999; font-size: 12px; text-align: center;">
|
||||
https://yyets.dmesg.app/</span>
|
||||
https://yyets.click/</span>
|
||||
<br><br>本邮件由系统自动发送,请勿回复。
|
||||
</td>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user