4

I am trying to download youtube videos and upload to 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))

Then

start_handler = CommandHandler('ytsearch',start_callback, pass_args=True)
dispatcher.add_handler(start_handler)

When I execute it locally everything is fine, however, I get this warning when I deploy it to Heroku: Cloud Application Platform.

RequestsDependencyWarning: urllib3 (1.25.3) or chardet (3.0.4) doesn't match a supported version!

I've already tried to update requests but it does not change anything.

I also tried RequestsDependencyWarning: urllib3 (1.9.1) or chardet (2.3.0) doesn't match a supported version but no change in Heroku.

Please help :/

  • Is this Python 2 or 3? Others have solved this problem by uninstalling 2 and installing 3 – clubby789 Aug 07 '19 at 13:05
  • Possible duplicate of [RequestsDependencyWarning: urllib3 (1.9.1) or chardet (2.3.0) doesn't match a supported version](https://stackoverflow.com/questions/50202238/requestsdependencywarning-urllib3-1-9-1-or-chardet-2-3-0-doesnt-match-a-su) – clubby789 Aug 07 '19 at 13:05
  • It is python 3, and everything works fine on localhost, yet when I deploy to Heroku the issue occurs. – Mark Hamazaspyan Aug 10 '19 at 12:48

1 Answers1

6

I fixed the issue by manually updating the requests package using pip:

pip install --upgrade requests
Chami Mohammed
  • 309
  • 3
  • 8