Mar*_*yan 4 python heroku youtube-dl telegram-bot
我正在尝试下载 YouTube 视频并上传到 telegram
def start_callback(bot, update, args):
if len(args)==1:
search="https://www.youtube.com/results?search_query="+args[0]
else:
search="https://www.youtube.com/results?search_query="+("+".join(args))
print
response = requests.get(search)
page = response.text
soup = BeautifulSoup(page,"lxml")
links=[]
for i in soup.find_all("a",{"aria-hidden":"true"}):
links.append("https://www.youtube.com"+i.attrs['href'])
for i in links[:10]:
update.message.reply_text(i)
#bot.send_message(chat_id="@marks_channel", text=i)
sleep(1)
update.message.reply_text("top 10 youtube videos for the "+" ".join(args))
Run Code Online (Sandbox Code Playgroud)
然后
start_handler = CommandHandler('ytsearch',start_callback, pass_args=True)
dispatcher.add_handler(start_handler)
Run Code Online (Sandbox Code Playgroud)
当我在本地执行它时,一切都很好,但是,当我将其部署到 Heroku:云应用程序平台时,我收到此警告。
RequestsDependencyWarning:urllib3 (1.25.3) 或 chardet (3.0.4) 与支持的版本不匹配!
我已经尝试更新requests,但它没有改变任何东西。
我还尝试了RequestsDependencyWarning: urllib3 (1.9.1) or chardet (2.3.0) 与支持的版本不匹配, 但 Heroku 中没有变化。
请帮忙 :/
小智 6
我通过使用 pip 手动更新请求包解决了该问题:
pip install --upgrade requests
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6465 次 |
| 最近记录: |