Search code examples
pythonvideokik

Send video from kik bot


I am trying to write a simple kik bot to send videos from youtube. Started with https://github.com/kikinteractive/kik-bot-python-example

Modified it this way:

        messages_to_send.append(
            VideoMessage(
                to=message.from_user,
                chat_id=message.chat_id,
                video_url="https://www.youtube.com/watch?v=WHATEVER"
            ))

But when try, i get an error like:

kik.error.KikError: {"message":"Error sending video message: text/html; charset=utf-8 is not a supported Content-Type","error":"BadRequest"}

Dont know from where is taking "text/html; charset=utf-8" because i ve defined is a VideoMessage(

Sorry if it is a silly question, i am noob with kik and python

Thanks in advance


Solution

  • I think the video_url parameter expects an URL that points to a video file. In the example from their docs the URL is "http://example.kik.com/video.mp4", meaning (in my opinion) that it should be a video file. In your example, "https://www.youtube.com/watch?v=WHATEVER" would point to an HTML file (i.e. not a video file).

    Maybe you'll have to find (a) if YouTube provides a URL that returns a video mimetype (I bet they don't), or (b) use something as youtube-dl to download the MP4 file, uplaod it somewhere else and use this somewhere-else's URL in yourt code snipet. Or… (c) just send a text message with the YouTube URL : )

    Does that make sense?