vimeo / vimeo.py

Official Python library for the Vimeo API.
https://developer.vimeo.com
Apache License 2.0
210 stars 84 forks source link

Bad response when uploading large videos using form-based approach #142

Open Kinozuko opened 5 years ago

Kinozuko commented 5 years ago

I'm using the form-based approach to upload videos, i'm gettin the upload link action on this way:

    def _upload_file_post_form(self,
                               redirect_url,
                               file_name,
                               file_description=""):
        response = self._service.post(
            "/me/videos",
            data={
                "name": file_name,
                "description": file_description,
                "privacy": {
                    "add": False,
                    "comments": "nobody",
                    "download": False,
                    "embed": "private",
                    "view": "unlisted",
                },
                "upload": {
                    "approach": "post",
                    "redirect_url": redirect_url,
                }
            })
        response = response.json()
        return {
            "video_id": self.get_id(file_name)['id'][8:],
            "upload_link": response.get("upload").get("upload_link"),
        }

After that i made a POST request to upload_link with a Multipart Form Body with a field called file_data, this POST works when i upload small videos, but with large videos i'm getting a bad response, but the videos are uploaded, that's why i don't know why i'm getting this response

image

Something the response is just ERROR

tommypenner commented 5 years ago

@Kinozuko How large are the video files you are attempting to upload? Can you try uploading with a video you created, or an open source video like Big Buck Bunny that allows open distribution? Not only is uploading TV show rips against Vimeo TOS, it's possible that the upload is failing or being rejected due to the file name Mr.Robot.S01E06 alone.

Kinozuko commented 5 years ago

The videos are 400MB+, i tried it with a video i create and the video is uploaded but i'm getting the same response, 503 or ERROR

tommypenner commented 5 years ago

@Kinozuko can you contact Vimeo and reference this GitHub issue in your message? We may need to troubleshoot in private and review account details.

https://vimeo.com/help/contact

Kinozuko commented 5 years ago

Hello, i tried to contact Vimeo but i didn't get a response

I was trying to make a post to upload_link with a file in multipart-form called file_data, with small videos works fine but with large video i'm getting timeout response and can't upload anythins, this happen wit videos of 150MB+

I tried diferrent videos

14MB -> Works fine 25MB -> Works fine 150MB -> Got timeout response 450MB -> Got timeout response

What should i do?

xtsimpouris commented 5 years ago

@Kinozuko have you found a robust solution for even big files? Can you share?

Kinozuko commented 5 years ago

@xtsimpouris my solution was used the "upload_link" from the response from /me/videos route from Vimeo API after that doing a request to "upload_link" with the difference the request was a PUT instead POST, that works from me, also the request was made from Front End using typescript. That was my solution, not a practical solution but it worked