更换域名

This commit is contained in:
Benny
2023-07-28 19:21:28 +02:00
parent 8c9b559321
commit 46205777eb
19 changed files with 146 additions and 129 deletions

View File

@@ -49,7 +49,7 @@ jobs:
GENERATE_SOURCEMAP: ${{ secrets.GENERATE_SOURCEMAP }} GENERATE_SOURCEMAP: ${{ secrets.GENERATE_SOURCEMAP }}
run: | run: |
bash scripts/pre_build.sh 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 - name: Install yarn
run: | run: |

View File

@@ -157,9 +157,9 @@ python /path/to/YYeTsBot/yyetsbot/bot.py
如果无法访问Telegram可以使用如下网址下载数据 如果无法访问Telegram可以使用如下网址下载数据
* [网站实时数据MongoDB](https://yyets.dmesg.app/data/yyets_mongo.gz) * [网站实时数据MongoDB](https://yyets.click/data/yyets_mongo.gz)
* [MySQL](https://yyets.dmesg.app/data/yyets_mysql.zip) * [MySQL](https://yyets.click/data/yyets_mysql.zip)
* [SQLite](https://yyets.dmesg.app/data/yyets_sqlite.zip) * [SQLite](https://yyets.click/data/yyets_sqlite.zip)
# API 文档 # API 文档

View File

@@ -5,7 +5,7 @@
* 人人影视bot[戳我使用](https://t.me/yyets_bot) * 人人影视bot[戳我使用](https://t.me/yyets_bot)
* 人人影视分享站,[戳我使用](https://yyets.dmesg.app/) * 人人影视分享站,[戳我使用](https://yyets.click/)
机器人和网站由我长期维护如果遇到问题可以提issue。 机器人和网站由我长期维护如果遇到问题可以提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` 1. 请到 [GitHub Release](https://github.com/tgbot-collection/YYeTsBot/releases) ,找最新的 `YYeTsBot App`
2. windows下载msimacos下载dmg或tar.gzLinux下载AppImage或debDebian based 2. windows下载msimacos下载dmg或tar.gzLinux下载AppImage或debDebian based
@@ -116,9 +116,9 @@ yyets_offline - 人人影视离线数据
``` ```
>>> from yyets import YYeTs >>> from yyets import YYeTs
>>> yy=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: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.dmesg.app/api/resource?id=29540 [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.dmesg.app/api/resource?id=37089 [2021-09-21 19:22:35 __init__.py:54 I] Fetching 逃避者...https://yyets.click/api/resource?id=37089
>>> yy.result >>> yy.result
[<yyets.Resource object at 0x10cc7b130>, <yyets.Resource object at 0x10ca0e880>, <yyets.Resource object at 0x10cc7b040>] [<yyets.Resource object at 0x10cc7b130>, <yyets.Resource object at 0x10ca0e880>, <yyets.Resource object at 0x10cc7b040>]

View File

@@ -8,7 +8,7 @@ pymongo==4.4.1
tornado==6.3.2 tornado==6.3.2
captcha==0.4 captcha==0.4
passlib==1.7.4 passlib==1.7.4
fakeredis==2.16.0 fakeredis==2.17.0
filetype==1.2.0 filetype==1.2.0
requests[socks] requests[socks]
tqdm==4.65.0 tqdm==4.65.0

View File

@@ -31,7 +31,7 @@ function import_db() {
docker-compose up -d mongo docker-compose up -d mongo
echo "[4/5] 正在下载并导入数据库" 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 file /tmp/yyets_mongo.gz
docker cp /tmp/yyets_mongo.gz yyets_mongo_1:/tmp docker cp /tmp/yyets_mongo.gz yyets_mongo_1:/tmp
# special for windows # special for windows

View File

@@ -13,7 +13,7 @@ from setuptools import Command, setup
# Package meta-data. # Package meta-data.
NAME = "yyets" NAME = "yyets"
DESCRIPTION = "https://yyets.dmesg.app/ wrapper" DESCRIPTION = "https://yyets.click/ wrapper"
URL = "https://github.com/tgbot-collection/YYeTsBot" URL = "https://github.com/tgbot-collection/YYeTsBot"
EMAIL = "benny.think@gmail.com" EMAIL = "benny.think@gmail.com"
AUTHOR = "BennyThink" AUTHOR = "BennyThink"

View File

@@ -7,10 +7,11 @@
__author__ = "Benny <benny.think@gmail.com>" __author__ = "Benny <benny.think@gmail.com>"
import requests
import logging import logging
API = "https://yyets.dmesg.app/api/resource?" import requests
API = "https://yyets.click/api/resource?"
logging.basicConfig( logging.basicConfig(
level=logging.INFO, level=logging.INFO,

View File

@@ -14,19 +14,20 @@ import requests
from apscheduler.schedulers.asyncio import AsyncIOScheduler from apscheduler.schedulers.asyncio import AsyncIOScheduler
from telethon import TelegramClient, events from telethon import TelegramClient, events
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")
logging.getLogger('apscheduler.executors.default').propagate = False logging.getLogger("apscheduler.executors.default").propagate = False
api_id = int(os.environ.get("API_ID") or "3") api_id = int(os.environ.get("API_ID") or "3")
api_hash = os.environ.get("API_HASH") or "4" api_hash = os.environ.get("API_HASH") or "4"
bot_name = os.environ.get("BOT_NAME") or "yyets_bot" bot_name = os.environ.get("BOT_NAME") or "yyets_bot"
bot_token = os.environ.get("BOT_token") or "123" bot_token = os.environ.get("BOT_token") or "123"
client = TelegramClient('client-hc', api_id, api_hash, client = TelegramClient(
device_model="Benny-health-check", system_version="89", app_version="1.0.0") "client-hc", api_id, api_hash, device_model="Benny-health-check", system_version="89", app_version="1.0.0"
)
check_status = [] 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): async def my_event_handler(event):
logging.info("Okay it's working %s", event) logging.info("Okay it's working %s", event)
check_status.clear() check_status.clear()
@@ -37,7 +38,7 @@ async def send_health_check():
# restart it # restart it
await bot_warning() await bot_warning()
else: else:
await client.send_message(bot_name, '/start') await client.send_message(bot_name, "/start")
check_status.append("check") check_status.append("check")
@@ -50,8 +51,8 @@ async def bot_warning():
async def website_check(): async def website_check():
home = "https://yyets.dmesg.app/" home = "https://yyets.click/"
top = "https://yyets.dmesg.app/api/top" top = "https://yyets.click/api/top"
message = "" message = ""
try: try:
resp1 = requests.get(home) 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)) 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 = AsyncIOScheduler()
scheduler.add_job(send_health_check, 'interval', seconds=300) scheduler.add_job(send_health_check, "interval", seconds=300)
scheduler.add_job(website_check, 'interval', seconds=60) scheduler.add_job(website_check, "interval", seconds=60)
scheduler.start() scheduler.start()
client.start() client.start()
client.run_until_disconnected() client.run_until_disconnected()

View File

@@ -20,7 +20,7 @@ logger = logging.getLogger()
logger.addHandler(handler) logger.addHandler(handler)
logger.setLevel(logging.INFO) logger.setLevel(logging.INFO)
URL = "https://yyets.dmesg.app/api/top" URL = "https://yyets.click/api/top"
# URL = "https://www.baidu.com/" # URL = "https://www.baidu.com/"
req = requests.get(URL) req = requests.get(URL)

View File

@@ -1,4 +1,4 @@
const baseURL = "https://yyets.dmesg.app/"; const baseURL = "https://yyets.click/";
const resourceURL = baseURL + "resource.html?id="; const resourceURL = baseURL + "resource.html?id=";
const indexURL = baseURL + "?id=index"; const indexURL = baseURL + "?id=index";

View File

@@ -43,7 +43,7 @@ async function handleEvent(event) {
return new Response(value, { return new Response(value, {
headers: { headers: {
"content-type": "application/json;charset=UTF-8", "content-type": "application/json;charset=UTF-8",
"Access-Control-Allow-Origin": "https://yyets.dmesg.app" "Access-Control-Allow-Origin": "https://yyets.click"
}, },
}) })

View File

@@ -26,9 +26,9 @@ FIX_SEARCH = "http://www.zimuxia.cn/?s={kw}"
ZHUIXINFAN_SEARCH = "http://www.fanxinzhui.com/list?k={}" ZHUIXINFAN_SEARCH = "http://www.fanxinzhui.com/list?k={}"
ZHUIXINFAN_RESOURCE = "http://www.fanxinzhui.com{}" ZHUIXINFAN_RESOURCE = "http://www.fanxinzhui.com{}"
# yyets website # yyets website
DOMAIN = "https://yyets.dmesg.app/" DOMAIN = "https://yyets.click/"
WORKERS = f"{DOMAIN}resource?id=" + "{}" WORKERS = f"{DOMAIN}resource?id=" + "{}"
# https://yyets.dmesg.app/discuss#6464d5b1b27861fa44647e7e # https://yyets.click/discuss#6464d5b1b27861fa44647e7e
DISCUSS = f"{DOMAIN}discuss#" + "{}" DISCUSS = f"{DOMAIN}discuss#" + "{}"
# new zmz # new zmz
NEWZMZ_SEARCH = "https://newzmz.com/subres/index/getres.html?keyword={}" NEWZMZ_SEARCH = "https://newzmz.com/subres/index/getres.html?keyword={}"

View File

@@ -230,8 +230,8 @@ class YYeTsOffline(BaseFansub):
def search_result(self, resource_url) -> dict: def search_result(self, resource_url) -> dict:
# yyets offline # yyets offline
# resource: https://yyets.dmesg.app/resource.html?id=37089 # resource: https://yyets.click/resource.html?id=37089
# comment: 'https://yyets.dmesg.app/resource.html?id=233#61893ae51e9152e43fa24124' # comment: 'https://yyets.click/resource.html?id=233#61893ae51e9152e43fa24124'
if "#" in resource_url: if "#" in resource_url:
cid = resource_url.split("#")[1] cid = resource_url.split("#")[1]
data: dict = self.db["comment"].find_one( data: dict = self.db["comment"].find_one(

View File

@@ -2,7 +2,7 @@
# YYeTsBot - bot.py # YYeTsBot - bot.py
# 2019/8/15 18:27 # 2019/8/15 18:27
__author__ = 'Benny <benny.think@gmail.com>' __author__ = "Benny <benny.think@gmail.com>"
import io import io
import json import json
@@ -21,43 +21,50 @@ from telebot import apihelper, types
from tgbot_ping import get_runtime from tgbot_ping import get_runtime
import fansub import fansub
from config import (DOMAIN, FANSUB_ORDER, MAINTAINER, PROXY, REPORT, TOKEN, from config import DOMAIN, FANSUB_ORDER, MAINTAINER, PROXY, REPORT, TOKEN, YYETS_SEARCH_URL
YYETS_SEARCH_URL) from utils import get_error_dump, redis_announcement, reset_request, save_error_dump, show_usage, today_request
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: if PROXY:
apihelper.proxy = {'https': PROXY} apihelper.proxy = {"https": PROXY}
bot = telebot.TeleBot(TOKEN, num_threads=100) bot = telebot.TeleBot(TOKEN, num_threads=100)
angry_count = 0 angry_count = 0
@bot.message_handler(commands=['start'], chat_types=['private']) @bot.message_handler(commands=["start"], chat_types=["private"])
def send_welcome(message): def send_welcome(message):
bot.send_chat_action(message.chat.id, 'typing') bot.send_chat_action(message.chat.id, "typing")
bot.send_message(message.chat.id, '欢迎使用,直接发送想要的剧集标题给我就可以了,不需要其他关键字,我会帮你搜索。\n\n' bot.send_message(
'仅私聊使用,群组功能已禁用。' message.chat.id,
f'目前搜索优先级 {FANSUB_ORDER}\n ' "欢迎使用,直接发送想要的剧集标题给我就可以了,不需要其他关键字,我会帮你搜索。\n\n"
f'另外,可以尝试使用一下 https://yyets.dmesg.app/ 哦!', "仅私聊使用,群组功能已禁用。"
parse_mode='html', disable_web_page_preview=True) 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): def send_help(message):
bot.send_chat_action(message.chat.id, 'typing') bot.send_chat_action(message.chat.id, "typing")
bot.send_message(message.chat.id, '''机器人无法使用或者报错?从 /ping 里可以看到运行状态以及最新信息。 bot.send_message(
message.chat.id,
"""机器人无法使用或者报错?从 /ping 里可以看到运行状态以及最新信息。
同时,你可以使用如下方式寻求使用帮助和报告错误:\n 同时,你可以使用如下方式寻求使用帮助和报告错误:\n
1. @BennyThink 1. @BennyThink
2. <a href='https://github.com/BennyThink/YYeTsBot/issues'>Github issues</a> 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): def send_ping(message):
logging.info("Pong!") 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") info = get_runtime("botsrunner_yyets_1")
@@ -67,11 +74,10 @@ def send_ping(message):
announcement = redis_announcement() or "" announcement = redis_announcement() or ""
if announcement: if announcement:
announcement = f"\n\n*公告:{announcement}*\n\n" announcement = f"\n\n*公告:{announcement}*\n\n"
bot.send_message(message.chat.id, f"{info}\n\n{usage}\n{announcement}", bot.send_message(message.chat.id, f"{info}\n\n{usage}\n{announcement}", parse_mode="markdown")
parse_mode='markdown')
@bot.message_handler(commands=['settings'], chat_types=['private']) @bot.message_handler(commands=["settings"], chat_types=["private"])
def settings(message): def settings(message):
is_admin = str(message.chat.id) == MAINTAINER 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)) @bot.callback_query_handler(func=lambda call: re.findall(r"announcement(\S*)", call.data))
def delete_announcement(call): 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") redis_announcement(op="del")
bot.edit_message_text(f"目前公告:\n\n {redis_announcement() or '暂无公告'}", bot.edit_message_text(f"目前公告:\n\n {redis_announcement() or '暂无公告'}", call.message.chat.id, call.message.message_id)
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): def send_credits(message):
bot.send_chat_action(message.chat.id, 'typing') bot.send_chat_action(message.chat.id, "typing")
bot.send_message(message.chat.id, '''感谢字幕组的无私奉献!本机器人资源来源:\n bot.send_message(
message.chat.id,
"""感谢字幕组的无私奉献!本机器人资源来源:\n
<a href="http://www.zmz2019.com/">人人影视</a> <a href="http://www.zmz2019.com/">人人影视</a>
<a href="http://cili001.com/">磁力下载站</a> <a href="http://cili001.com/">磁力下载站</a>
<a href="http://www.zhuixinfan.com/main.php">追新番</a> <a href="http://www.zhuixinfan.com/main.php">追新番</a>
<a href="https://www.zimuxia.cn/">FIX 字幕侠</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): for sub_name in dir(fansub):
if sub_name.endswith("_offline") or sub_name.endswith("_online"): 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): def varies_fansub(message):
bot.send_chat_action(message.chat.id, 'typing') bot.send_chat_action(message.chat.id, "typing")
# /YYeTsOffline 逃避可耻 /YYeTsOffline # /YYeTsOffline 逃避可耻 /YYeTsOffline
tv_name: str = re.findall(r"/.*line\s*(\S*)", message.text)[0] tv_name: str = re.findall(r"/.*line\s*(\S*)", message.text)[0]
class_name: str = re.findall(r"/(.*line)", message.text)[0] class_name: str = re.findall(r"/(.*line)", message.text)[0]
class_ = getattr(fansub, class_name) class_ = getattr(fansub, class_name)
if not tv_name: if not tv_name:
bot.send_message(message.chat.id, bot.send_message(
f"{class_.__name__}: 请附加你要搜索的剧集名称,如 `/{class_name} 逃避可耻`", message.chat.id, f"{class_.__name__}: 请附加你要搜索的剧集名称,如 `/{class_name} 逃避可耻`", parse_mode="markdown"
parse_mode='markdown') )
return return
else: else:
@@ -154,16 +164,16 @@ def download_to_io(photo):
def send_my_response(message): 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 # I may also send picture
photo = message.photo photo = message.photo
uid = message.reply_to_message.caption uid = message.reply_to_message.caption
text = f"主人说:{message.text or message.caption or '啥也没说😯'}" text = f"主人说:{message.text or message.caption or '啥也没说😯'}"
if photo: if photo:
bot.send_chat_action(message.chat.id, 'typing') bot.send_chat_action(message.chat.id, "typing")
logging.info("Photo received from maintainer") logging.info("Photo received from maintainer")
mem = download_to_io(photo) mem = download_to_io(photo)
mem.name = f'{uid}.jpg' mem.name = f"{uid}.jpg"
r = bot.send_photo(uid, mem.getvalue(), caption=text) r = bot.send_photo(uid, mem.getvalue(), caption=text)
else: else:
r = bot.send_message(uid, text) r = bot.send_message(uid, text)
@@ -176,7 +186,7 @@ def send_my_response(message):
logging.info("Forward has been deleted.") 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): def send_search(message):
if str(message.chat.id) == os.getenv("SPECIAL_ID") and message.text == "❤️": if str(message.chat.id) == os.getenv("SPECIAL_ID") and message.text == "❤️":
bot.reply_to(message, "❤️") bot.reply_to(message, "❤️")
@@ -187,7 +197,7 @@ def send_search(message):
base_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): def ban_user(message):
if str(message.chat.id) != MAINTAINER: if str(message.chat.id) != MAINTAINER:
return return
@@ -220,20 +230,24 @@ def base_send_search(message, instance=None):
fan = fansub.FansubEntrance() fan = fansub.FansubEntrance()
else: else:
fan = instance fan = instance
bot.send_chat_action(message.chat.id, 'typing') bot.send_chat_action(message.chat.id, "typing")
today_request("total") today_request("total")
if message.reply_to_message and message.reply_to_message.document and \ if (
message.reply_to_message.document.file_name.startswith("error") and str(message.chat.id) == MAINTAINER: 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") today_request("answer")
send_my_response(message) send_my_response(message)
return return
name = zhconv.convert(message.text, "zh-hans") 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: if name is None:
today_request("invalid") 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_message(message.chat.id, "不要调戏我!我会报警的")
bot.send_sticker(message.chat.id, sti) bot.send_sticker(message.chat.id, sti)
return return
@@ -256,25 +270,34 @@ def base_send_search(message, instance=None):
if result: if result:
logging.info("🎉 Resource match.") logging.info("🎉 Resource match.")
today_request("success") today_request("success")
bot.reply_to(message, f"{warning}呐🌹,一共%d个结果选一个呀来源%s" % (len(result), source), bot.reply_to(
reply_markup=markup, parse_mode="markdown") message,
f"{warning}呐🌹,一共%d个结果选一个呀来源%s" % (len(result), source),
reply_markup=markup,
parse_mode="markdown",
)
else: else:
logging.warning("⚠️️ Resource not found") logging.warning("⚠️️ Resource not found")
today_request("fail") today_request("fail")
bot.send_chat_action(message.chat.id, 'typing') bot.send_chat_action(message.chat.id, "typing")
encoded = quote_plus(name) encoded = quote_plus(name)
bot.reply_to(message, f"没有找到你想要的信息,是不是你打了错别字,或者搜索了一些国产影视剧。🤪\n" bot.reply_to(
f"还是你想调戏我哦🙅‍ 本小可爱拒绝被调戏️\n\n" message,
"⚠️如果确定要我背锅,那么请使用 /help 来提交错误", disable_web_page_preview=True) f"没有找到你想要的信息,是不是你打了错别字,或者搜索了一些国产影视剧。🤪\n" f"还是你想调戏我哦🙅‍ 本小可爱拒绝被调戏️\n\n" "⚠️如果确定要我背锅,那么请使用 /help 来提交错误",
disable_web_page_preview=True,
)
if REPORT: if REPORT:
btn = types.InlineKeyboardButton("快来修复啦", callback_data="fix") btn = types.InlineKeyboardButton("快来修复啦", callback_data="fix")
markup.add(btn) markup.add(btn)
bot.send_chat_action(message.chat.id, 'upload_document') bot.send_chat_action(message.chat.id, "upload_document")
bot.send_message(message.chat.id, f"{name}》😭\n大部分情况下机器人是好用的,不要怀疑我的代码质量.\n" bot.send_message(
f"如果你真的确定是机器人出问题了,那么点下面的按钮叫 @BennyThink 来修!\n" message.chat.id,
f"⚠️报错前请三思,不要乱点,确保这锅应该甩给我。否则我会很生气的😡小心被拉黑哦", f"{name}》😭\n大部分情况下机器人是好用的,不要怀疑我的代码质量.\n"
reply_markup=markup) 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}) 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))} 问题发生时间:{time.strftime("%Y-%m-%data %H:%M:%S", time.localtime(message.date))}
请求内容:{name} 请求内容:{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)) @bot.callback_query_handler(func=lambda call: re.findall(r"choose(\S*)", call.data))
def choose_link(call): def choose_link(call):
fan = fansub.FansubEntrance() 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 # call.data is url_hash, with sha1, http://www.rrys2020.com/resource/36588
resource_url_hash = re.findall(r"choose(\S*)", call.data)[0] resource_url_hash = re.findall(r"choose(\S*)", call.data)[0]
if magic_recycle(fan, call, resource_url_hash): if magic_recycle(fan, call, resource_url_hash):
return return
result = fan.search_result(resource_url_hash) result = fan.search_result(resource_url_hash)
with tempfile.NamedTemporaryFile(mode='wb+', prefix=result["cnname"].replace("/", " "), suffix=".txt") as tmp: 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') bytes_data = json.dumps(result["all"], ensure_ascii=False, indent=4).encode("u8")
tmp.write(bytes_data) tmp.write(bytes_data)
tmp.flush() tmp.flush()
with open(tmp.name, "rb") as f: with open(tmp.name, "rb") as f:
@@ -313,31 +336,25 @@ def choose_link(call):
caption = "{}\n\n{}".format(result["cnname"], result["share"]) caption = "{}\n\n{}".format(result["cnname"], result["share"])
else: else:
caption = result["all"].replace(r"\n", " ") 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.send_document(call.message.chat.id, f, caption=caption)
@bot.callback_query_handler(func=lambda call: re.findall(r"approve", call.data)) @bot.callback_query_handler(func=lambda call: re.findall(r"approve", call.data))
def approve_spam(call): def approve_spam(call):
obj_id = re.findall(r"approve(\S*)", call.data)[0] obj_id = re.findall(r"approve(\S*)", call.data)[0]
data = { data = {"obj_id": obj_id, "token": TOKEN}
"obj_id": obj_id,
"token": TOKEN
}
requests.post(f"{DOMAIN}api/admin/spam", json=data) 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.delete_message(call.message.chat.id, call.message.message_id)
@bot.callback_query_handler(func=lambda call: re.findall(r"ban", call.data)) @bot.callback_query_handler(func=lambda call: re.findall(r"ban", call.data))
def ban_spam(call): def ban_spam(call):
obj_id = re.findall(r"ban(\S*)", call.data)[0] obj_id = re.findall(r"ban(\S*)", call.data)[0]
data = { data = {"obj_id": obj_id, "token": TOKEN}
"obj_id": obj_id,
"token": TOKEN
}
requests.delete(f"{DOMAIN}api/admin/spam", json=data) 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) 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 # this will come from me only
logging.warning("I'm so unhappy!") logging.warning("I'm so unhappy!")
message = call.message message = call.message
bot.send_chat_action(message.chat.id, 'typing') bot.send_chat_action(message.chat.id, "typing")
# angry_count = angry_count + 1 # angry_count = angry_count + 1
global angry_count global angry_count
@@ -354,23 +371,21 @@ def send_unwelcome(call):
uid = re.findall(r"unwelcome(\d*)", call.data)[0] uid = re.findall(r"unwelcome(\d*)", call.data)[0]
if uid: if uid:
text = "人人影视主要提供欧美日韩等海外资源,你的这个真没有🤷‍。\n" \ text = "人人影视主要提供欧美日韩等海外资源,你的这个真没有🤷‍。\n" "<b>麻烦你先从自己身上找原因</b>,我又不是你的专属客服。\n" "不要再报告这种错误了🙄️,面倒な。😡"
"<b>麻烦你先从自己身上找原因</b>,我又不是你的专属客服。\n" \
"不要再报告这种错误了🙄️,面倒な。😡"
bot.send_message(uid, text, parse_mode="html") bot.send_message(uid, text, parse_mode="html")
bot.reply_to(message, f"有生之日 生气次数:{angry_count}") 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): def report_error(call):
logging.error("Reporting error to maintainer.") 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) error_content = get_error_dump(call.message.chat.id)
if error_content == "": if error_content == "":
bot.answer_callback_query(call.id, '多次汇报重复的问题并不会加快处理速度。', show_alert=True) bot.answer_callback_query(call.id, "多次汇报重复的问题并不会加快处理速度。", show_alert=True)
return return
text = f'人人影视机器人似乎出现了一些问题🤔🤔🤔……{error_content[0:300]}' text = f"人人影视机器人似乎出现了一些问题🤔🤔🤔……{error_content[0:300]}"
markup = types.InlineKeyboardMarkup() markup = types.InlineKeyboardMarkup()
btn = types.InlineKeyboardButton("unwelcome", callback_data=f"unwelcome{call.message.chat.id}") 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) 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: with tempfile.NamedTemporaryFile(mode="wb+", prefix=f"error_{call.message.chat.id}_", suffix=".txt") as tmp:
tmp.write(error_content.encode('u8')) tmp.write(error_content.encode("u8"))
tmp.flush() tmp.flush()
with open(tmp.name, "rb") as f: 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.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__': if __name__ == "__main__":
logging.info('YYeTs bot is running...') logging.info("YYeTs bot is running...")
scheduler = BackgroundScheduler() scheduler = BackgroundScheduler()
scheduler.add_job(reset_request, 'cron', hour=0, minute=0) scheduler.add_job(reset_request, "cron", hour=0, minute=0)
scheduler.start() scheduler.start()
bot.polling() bot.polling()

View File

@@ -10,7 +10,7 @@
# 导入数据 # 导入数据
从 [这里](https://yyets.dmesg.app/database) 下载mongodb数据然后导入 从 [这里](https://yyets.click/database) 下载mongodb数据然后导入
```shell ```shell
mongorestore --gzip --archive=yyets_mongo.gz --nsFrom "share.*" --nsTo "zimuzu.*" mongorestore --gzip --archive=yyets_mongo.gz --nsFrom "share.*" --nsTo "zimuzu.*"

View File

@@ -98,7 +98,7 @@ def check_spam(ip, ua, author, content) -> int:
return 0 return 0
if token: if token:
with contextlib.suppress(Exception): with contextlib.suppress(Exception):
akismet = Akismet(token, blog="https://yyets.dmesg.app/") akismet = Akismet(token, blog="https://yyets.click/")
return akismet.check( return akismet.check(
ip, ip,

View File

@@ -222,9 +222,9 @@ class Comment(Mongo):
# send email # send email
parent_comment = self.db["comment"].find_one({"_id": ObjectId(parent_comment_id)}) parent_comment = self.db["comment"].find_one({"_id": ObjectId(parent_comment_id)})
if resource_id == 233: if resource_id == 233:
link = f"https://yyets.dmesg.app/discuss#{parent_comment_id}" link = f"https://yyets.click/discuss#{parent_comment_id}"
else: 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}) user_info = self.db["users"].find_one({"username": parent_comment["username"], "email.verified": True})
if user_info: if user_info:
subject = "[人人影视下载分享站] 你的评论有了新的回复" subject = "[人人影视下载分享站] 你的评论有了新的回复"

View File

@@ -129,7 +129,7 @@ func announcement(c *gin.Context) {
"data": []Announcement{{ "data": []Announcement{{
Username: "Benny", Username: "Benny",
Date: buildTime, Date: buildTime,
Content: "YYeTs一键运行包 https://yyets.dmesg.app/。", Content: "YYeTs一键运行包 https://yyets.click/。",
}}, }},
}) })
} }
@@ -156,7 +156,7 @@ func douban(c *gin.Context) {
if doubanInfo == "" { if doubanInfo == "" {
var image Image var image Image
log.Warnf("Douban resource not found, requesting to main site ...") 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) body, _ := io.ReadAll(resp.Body)
doubanInfo = string(body) doubanInfo = string(body)
json.Unmarshal(body, &image) json.Unmarshal(body, &image)
@@ -216,7 +216,7 @@ func downloadDB() {
} }
log.Infoln("Downloading database file...") 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) resp, _ := http.Get(downloadUrl)
file, _ := os.Create("yyets_sqlite.zip") file, _ := os.Create("yyets_sqlite.zip")
_, _ = io.Copy(file, resp.Body) _, _ = io.Copy(file, resp.Body)

View File

@@ -100,7 +100,7 @@
</head> </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%;"> <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" <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" <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%;" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; background-color: #f6f6f6; width: 100%;"
width="100%" bgcolor="#f6f6f6"> width="100%" bgcolor="#f6f6f6">
@@ -153,13 +153,13 @@
<td class="content-block" <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;" 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"> 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;"> style="color: #999999; font-size: 12px; text-align: center;">
人人影视下载分享站</span></a> 人人影视下载分享站</span></a>
<span class="apple-link" <span class="apple-link"
style="color: #999999; font-size: 12px; text-align: center;"> style="color: #999999; font-size: 12px; text-align: center;">
https://yyets.dmesg.app/</span> https://yyets.click/</span>
<br><br>本邮件由系统自动发送,请勿回复。 <br><br>本邮件由系统自动发送,请勿回复。
</td> </td>