2
2
from req import PostRequest
3
3
import json ,os
4
4
from dotenv import load_dotenv
5
+ from telebot .formatting import escape_markdown
5
6
6
7
load_dotenv ()
7
8
BOT_USERNAME = os .environ ['BOT_USERNAME' ]
@@ -13,10 +14,11 @@ async def v5(content,page):
13
14
return 'Connection Error, please contact bot admin'
14
15
else :
15
16
j = json .loads (str (r ))
16
- reply_content = '\n ' .join ([' ' .join ([
17
- str (x ) for x in [i ['title' ],i ['author' ],i ['publisher' ],i ['extension' ],
18
- await (pybyte (i ['filesize' ])),'\n [Click here and start 点击这里并点击下方对话框start下载](https://t.me/' + BOT_USERNAME + '?start=' ,i ['id' ],')' ]])
19
- for i in j ['data' ]])
17
+ reply_content = ""
18
+ for i in j ['data' ]:
19
+ reply_content = reply_content + escape_markdown (' ' .join ([str (i ['title' ]),str (i ['author' ]),str (i ['publisher' ]),str (i ['extension' ])]))
20
+ reply_content = reply_content + escape_markdown (str (await pybyte (i ['filesize' ])))
21
+ reply_content = reply_content + '\n [Click here and start 点击这里并点击下方对话框start下载](https://t.me/' + BOT_USERNAME + '?start=' + str (i ['id' ])+ ')\n '
20
22
return reply_content
21
23
22
24
@@ -39,17 +41,17 @@ async def detail(id):
39
41
return 'Connection Error, please contact bot admin'
40
42
else :
41
43
j = json .loads (str (r ))
42
- file_name = j ['title' ]+ '_' + j ['author' ]+ '.' + j ['extension' ]
44
+ file_name = escape_markdown ( j ['title' ]+ '_' + j ['author' ]+ '.' + j ['extension' ])
43
45
try :
44
46
reply_content = []
45
47
# 转义问题无法解决,会出现 奇怪的效果,见 /detail 3556456,这里先用 行内代码顶一下
46
48
if j .get ('md5' ) and j .get ('filesize' ):
47
- rapid_code = '{}#{}#{}_{} .{}' .format (j ['md5' ],j ['filesize' ],j ['title' ], j [ 'author ' ],j ['extension' ])
48
- reply_content .append ('*RapidUpload_Code(BaiduNetDisk)*: ` https://rapidupload.1kbtool.com/{}` ' .format (rapid_code ))
49
+ rapid_code = '{}#{}#{}.{}' .format (j ['md5' ],j ['filesize' ],j ['title' ],j ['extension' ])
50
+ reply_content .append ('*RapidUpload_Code(BaiduNetDisk)*: [点击此处跳转到秒传网页]( https://rapidupload.1kbtool.com/{}) ' .format (rapid_code ))
49
51
if j .get ('ipfs_cid' ):
50
- reply_content .append ('*IPFS:* ` https://ipfs-checker.1kbtool.com/{}?filename={}` ' .format (j ['ipfs_cid' ],file_name ))
52
+ reply_content .append ('*IPFS:* [IPFS LINK | 点击此处跳转到IPFS]( https://ipfs-checker.1kbtool.com/{}?filename={}) ' .format (j ['ipfs_cid' ],file_name ))
51
53
if j .get ('in_libgen' ) and j .get ('md5' ):
52
- reply_content .append ('*Libgen* ` https://libgendown.1kbtool.com/{}` ' .format (j ['md5' ]))
54
+ reply_content .append ('*Libgen* [Libgeb LINK | 点击此处跳转到libgen]( https://libgendown.1kbtool.com/{}) ' .format (j ['md5' ]))
53
55
# if j.get('md5') and j.get('filesize'):
54
56
# rapid_code = '{}#{}#{}_{}.{}'.format(j['md5'],j['filesize'],j['title'],j['author'],j['extension'])
55
57
# reply_content.append('*RapidUpload_Code(BaiduNetDisk)*: [RapidUpload GUI](https://rapidupload.1kbtool.com/{})'.format(rapid_code))
@@ -58,6 +60,6 @@ async def detail(id):
58
60
# if j.get('in_libgen') and j.get('md5'):
59
61
# reply_content.append('*Libgen*: [Libgen Tool](https://libgendown.1kbtool.com/{})'.format(j['md5']))
60
62
reply_content = '\n ' .join (reply_content )
61
- await ( bot . reply_to ( message , reply_content , parse_mode = "Markdown" ))
63
+ return reply_content
62
64
except :
63
- await ( bot . reply_to ( message , 'Connection Error, please contact bot admin' ))
65
+ return 'Connection Error, please contact bot admin'
0 commit comments