APPEND call in Video upload API giving error when 2nd chunk uploaded

video
media-upload

#1

We can easily upload 5MB or less video file using the chunked media REST API. However if we upload a bigger than 5MB file, which makes send another chunk, because we are chunking at 5MB, it always fails with this error: segment size must be >= 1 java.nio.HeapByteBuffer[pos=64 lim=64 cap=66]

In simpler terms, whenever you send segment_index > 0 the API call fails with the above error.

I have already looked at: APPEND call in Video upload API giving error

And this seems to be an issue with Twitter side. Can anyone please help us resolve this ? We are sure our implementation is correct.


#2

Are you able to upload the same file using our large video upload sample?


#3

That script dies, before it starts. I followed the ReadMe, and added tokens and the path to the video file. I have python 2.7.2:

$ python async-upload.py INIT Traceback (most recent call last): File "async-upload.py", line 166, in <module> videoTweet.upload_init() File "async-upload.py", line 52, in upload_init req = requests.post(url=MEDIA_ENDPOINT_URL, data=request_data, auth=oauth) File "/Library/Python/2.7/site-packages/requests/api.py", line 111, in post return request('post', url, data=data, json=json, **kwargs) File "/Library/Python/2.7/site-packages/requests/api.py", line 57, in request return session.request(method=method, url=url, **kwargs) File "/Library/Python/2.7/site-packages/requests/sessions.py", line 475, in request resp = self.send(prep, **send_kwargs) File "/Library/Python/2.7/site-packages/requests/sessions.py", line 585, in send r = adapter.send(request, **kwargs) File "/Library/Python/2.7/site-packages/requests/adapters.py", line 467, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='upload.twitter.com', port=443): Max retries exceeded with url: /1.1/media/upload.json (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10dc17ed0>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',))


#4

Okay I reckoned it was python3 code. Ran it with python3 and it is working, I am investigating what is different from our implementation.


#5

Hi @tal_asad,

I actually have the same error code with a PHP script. Could you tell me how you resolved it in your case ?
Maybe it can help me :slight_smile:

best,


#6

We had a small bug in our code which was not properly encoding the data that was being sent.

In addition to that, after studying their code, I found out about STATUS command and media_category which are not documented AFAIK.