ready to release

This commit is contained in:
Benny
2019-08-16 09:31:34 +08:00
parent ae35017b16
commit b318e04d61
7 changed files with 85 additions and 9 deletions

View File

@@ -1,2 +1,50 @@
# YYeTsBot
人人影视bot
人人影视bot[戳我使用](https://t.me/yyets_bot)
# 使用说明
直接发送想要看的剧集名称就可以了会返回ed2k和磁力链接
# 截图
![](assets/1.jpg)
![](assets/2.jpg)
# 部署方法
## 1. 环境
推荐使用Python 3Python 2未进行测试使用pip安装依赖
```bash
pip install requests pytelegrambotapi beautifulsoup4
```
## 2. 配置TOKEN
修改`config.py`把TOKEN修改为你的bot token
## 3. 克隆&运行
```bash
git clone https://github.com/BennyThink/YYeTsBot
python /path/to/YYeTsBot/bot.py
```
## 4. systemd 单元文件
```bash
[Unit]
Description=A Telegram Bot for YYeTs
After=network.target network-online.target nss-lookup.target
[Service]
User=nobody
Group=nobody
Restart=on-failure
Type=simple
ExecStart=/usr/bin/python /home/YYeTsBot/bot.py
[Install]
WantedBy=multi-user.target
```
# Credits
* [人人影视](http://www.zmz2019.com/)
* [追新番](http://www.zhuixinfan.com/main.php)
* [FIX字幕侠](http://www.zimuxia.cn/)
* [磁力下载站](http://oabt005.com/home.html)
# License
[MIT](LICENSE)

BIN
assets/1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

BIN
assets/2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

26
bot.py
View File

@@ -7,14 +7,17 @@ __author__ = 'Benny <benny.think@gmail.com>'
import os
import logging
import telebot
from telebot import apihelper
from config import TOKEN
from telebot import types
from utils import bunch_upsert, get
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(filename)s [%(levelname)s]: %(message)s')
from html_parser import parser
from html_request import get_html
apihelper.proxy = {'socks5': 'socks5://127.0.0.1:1080'}
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(filename)s [%(levelname)s]: %(message)s')
# from telebot import apihelper
# apihelper.proxy = {'socks5': 'socks5://127.0.0.1:1080'}
bot = telebot.TeleBot(os.environ.get('TOKEN') or TOKEN)
@@ -26,19 +29,26 @@ def send_welcome(message):
@bot.message_handler(commands=['help'])
def send_welcome(message):
def send_help(message):
bot.send_chat_action(message.chat.id, 'typing')
bot.send_message(message.chat.id, '''机器人无法使用或者报错?
@BennyThink 或者<a href='https://github.com/BennyThink/YYeTsBot/issues'>Github issues</a>''',
parse_mode='html')
from html_parser import parser
from html_request import get_html
@bot.message_handler(commands=['credits'])
def send_credits(message):
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://oabt005.com/home.html">磁力下载站</a>
<a href="http://www.zhuixinfan.com/main.php ">追新番</a>
<a href="http://www.zimuxia.cn/">FIX字幕侠</a>
''', parse_mode='html')
@bot.message_handler()
def send_welcome(message):
def send_link(message):
bot.send_chat_action(message.chat.id, 'record_video')
name = message.text
logging.info('Receiving message about %s from user %s(%s)' % (name, message.chat.username,
@@ -73,6 +83,8 @@ def send_welcome(message):
def callback_handle(call):
bot.send_chat_action(call.message.chat.id, 'typing')
dict_r = get(call.data)
if not dict_r:
bot.send_message(call.message.chat.id, '请在聊天框内重新发送你想要的影视名称')
bot.answer_callback_query(call.id, '文件大小为%s' % dict_r['size'])
bot.send_message(call.message.chat.id, dict_r['ed2k'])
bot.send_message(call.message.chat.id, dict_r['magnet'])

View File

@@ -4,4 +4,4 @@
__author__ = 'Benny <benny.think@gmail.com>'
TOKEN="TOKEN"
TOKEN = "TOKEN"

3
requirements.txt Normal file
View File

@@ -0,0 +1,3 @@
requests
pytelegrambotapi
beautifulsoup4

13
yyets.service Normal file
View File

@@ -0,0 +1,13 @@
[Unit]
Description=A Telegram Bot for YYeTs
After=network.target network-online.target nss-lookup.target
[Service]
User=nobody
Group=nobody
Restart=on-failure
Type=simple
ExecStart=/usr/bin/python /home/YYeTsBot/bot.py
[Install]
WantedBy=multi-user.target