-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Video from remote source #465
Comments
I'm not sure how this is useful. The media file has to be uploaded directly to Twitter so the file will have to be local on this server regardless. |
I am able to upload to Twitter from a CDN without saving the file locally, but with filesize() it can't get the remote file in bytes and crashes. If I specify total_bytes with that command it lets me push the file from the cdn to Twitter. |
How are you doing that? Reading POST media/upload the API requires either |
Ok, this is an example of a video on Facebook that I can upload to Twitter: The url is an mp4 file. |
But how do you upload it to twitter? |
Say the $videoUrl is the URL I posted:
|
Ah, I see what's happening. Twitter is not fetching the remote URL, fopen if fetching it within the TwitterOAuth code and then uploading it to Twitter. You should be downloading the file within your own code and passing a path to the TwitterOAuth I'm leaving this issue open as a task to remove unintended URL support from the |
This might end up being a feature of #681 |
this pakage is simple and easy to implement... my code is : |
You'll have to download the file first. There are several approaches you can use to accomplish this. https://stackoverflow.com/questions/3938534/download-file-to-server-from-url |
In TwitterOAuth.php line 269 total_bytes pulls the file source locally using filesize($parameters['media']) but doesn't allow from remote sources such as a CDN without first copying the file locally.
If you allow a parameter of total_bytes, the file can be pulled from a remote source just by posting the file size in bytes.
Current:
'total_bytes' => filesize($parameters['media'])
New:
'total_bytes' => isset($parameters['total_bytes']) ? $parameters['total_bytes'] : filesize($parameters['media'])
If you want to take it further you can add in the remote file size in the API and do it automatically by specifying a remote file parameter.
Where
$sizeBytes
is total_bytesThe text was updated successfully, but these errors were encountered: