mirror of
https://github.com/omg-xtao/ytdlbot.git
synced 2024-11-16 03:45:23 +00:00
disable search now
This commit is contained in:
parent
2d7056899b
commit
6a4a0ff450
@ -11,7 +11,7 @@ flower==1.1.0
|
||||
psutil==5.9.1
|
||||
influxdb==5.3.1
|
||||
beautifulsoup4==4.11.1
|
||||
fakeredis==1.8.1
|
||||
fakeredis==1.8.2
|
||||
supervisor==4.2.4
|
||||
tgbot-ping==1.0.4
|
||||
redis==4.3.3
|
||||
|
@ -269,25 +269,28 @@ def download_handler(client: "Client", message: "types.Message"):
|
||||
logging.info("start %s", url)
|
||||
|
||||
if not re.findall(r"^https?://", url.lower()):
|
||||
red.update_metrics("search_request")
|
||||
# TODO
|
||||
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)
|
||||
red.update_metrics("bad_request")
|
||||
message.reply_text("I think you should send me a link.", quote=True)
|
||||
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)):
|
||||
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(InfluxDB().collect_data, 'interval', seconds=60)
|
||||
# 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()
|
||||
banner = f"""
|
||||
▌ ▌ ▀▛▘ ▌ ▛▀▖ ▜ ▌
|
||||
|
Loading…
Reference in New Issue
Block a user