disable search now

This commit is contained in:
BennyThink 2022-07-28 21:31:01 +08:00
parent 2d7056899b
commit 6a4a0ff450
No known key found for this signature in database
GPG Key ID: 6CD0DBDA5235D481
2 changed files with 23 additions and 20 deletions

View File

@ -11,7 +11,7 @@ flower==1.1.0
psutil==5.9.1 psutil==5.9.1
influxdb==5.3.1 influxdb==5.3.1
beautifulsoup4==4.11.1 beautifulsoup4==4.11.1
fakeredis==1.8.1 fakeredis==1.8.2
supervisor==4.2.4 supervisor==4.2.4
tgbot-ping==1.0.4 tgbot-ping==1.0.4
redis==4.3.3 redis==4.3.3

View File

@ -269,25 +269,28 @@ def download_handler(client: "Client", message: "types.Message"):
logging.info("start %s", url) logging.info("start %s", url)
if not re.findall(r"^https?://", url.lower()): if not re.findall(r"^https?://", url.lower()):
red.update_metrics("search_request") red.update_metrics("bad_request")
# TODO message.reply_text("I think you should send me a link.", quote=True)
result = VideosSearch(url, limit=5).result().get("result", [])
text = ""
count = 1
buttons = []
for item in result:
text += f"{count}. {item['title']} - {item['link']}\n\n"
buttons.append(
InlineKeyboardButton(
f"{count}",
callback_data=f"search_{item['id']}"
)
)
count += 1
markup = InlineKeyboardMarkup([buttons])
client.send_message(chat_id, text, disable_web_page_preview=True, reply_markup=markup)
return return
# TODO
# red.update_metrics("search_request")
# result = VideosSearch(url, limit=5).result().get("result", [])
# text = ""
# count = 1
# buttons = []
# for item in result:
# text += f"{count}. {item['title']} - {item['link']}\n\n"
# buttons.append(
# InlineKeyboardButton(
# f"{count}",
# callback_data=f"search_{item['id']}"
# )
# )
# count += 1
#
# markup = InlineKeyboardMarkup([buttons])
# client.send_message(chat_id, text, disable_web_page_preview=True, reply_markup=markup)
# return
if re.findall(r"^https://www\.youtube\.com/channel/", VIP.extract_canonical_link(url)): if re.findall(r"^https://www\.youtube\.com/channel/", VIP.extract_canonical_link(url)):
message.reply_text("Channel download is disabled now. Please send me individual video link.", quote=True) message.reply_text("Channel download is disabled now. Please send me individual video link.", quote=True)
@ -376,7 +379,7 @@ if __name__ == '__main__':
scheduler.add_job(auto_restart, 'interval', seconds=5) scheduler.add_job(auto_restart, 'interval', seconds=5)
scheduler.add_job(InfluxDB().collect_data, 'interval', seconds=60) scheduler.add_job(InfluxDB().collect_data, 'interval', seconds=60)
# default quota allocation of 10,000 units per day, # default quota allocation of 10,000 units per day,
scheduler.add_job(periodic_sub_check, 'interval', seconds=60 * 60) scheduler.add_job(periodic_sub_check, 'interval', seconds=60 * 30)
scheduler.start() scheduler.start()
banner = f""" banner = f"""