Repository navigation
Upload video media through PostSyncer's file endpoint - #243
Merged
Merged
Conversation
PostSyncer's URL import now stores no videos (200, count_stored 0), so video groups download each media URL to a temp file and upload it to upload.postsyncer.com/api/v1/media/upload/file, keeping URL order. Download failures, the 500 MB cap, and a rejection before any file is stored are safe to retry; a lost upload response stays uncertain. PublishVideoJob's timeout goes from 180 to 900 seconds to fit the transfers.
… cap Every download hop must be an https Google Drive host that passes PublicUrlGuard, with DNS pinned; redirects are followed manually (max 5). Content-Length or streamed bytes over 500 MB abort the download. A failure after a file was stored names the stored media ids.
Guzzle 8 rejects raw CURLOPT_PROGRESSFUNCTION in the curl option, so the cap stays on Guzzle's progress option, which aborts when the callback returns true. A test streams from a local server through Guzzle's cURL handler and checks the transfer stops before the full file arrives.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
PostSyncer's
POST /media/upload/urlnow stores no videos: it returns200 {"media":[],"count_stored":0}for Drive video links and for a public non-Drive mp4. Images still import. Every video publish fails with "incomplete media upload response" (BV-109 blocked). The multipart file endpoint onupload.postsyncer.comworks (135 MB mp4, 201 in 36 s).What
PostsyncerClient::uploadFilesFromUrls(): streams each media URL to a temp file (sink), then uploads it tohttps://upload.postsyncer.com/api/v1/media/upload/file, one file per request, ids in URL order. Temp files are always deleted.PublishVideoActionuses it for every video group (video and cover). Standalone posts are unchanged.<key>:media:<index>), so one key never covers two files.PublishVideoJobtimeout 180 s to 900 s (overlap lock 1020 s), matchingPublishPostJob, the worker's--timeout=900, and the 960 s retry_after/drain window. Download and upload calls use the existing 300 s HTTP timeout.Tests
New client tests (order, upload host, multipart, per-file keys, uncertain on connection error, safe on first-file 422, unsafe after a stored file, download failure sends nothing, HTML page, size cap, temp cleanup). Video action, API, and reconcile tests moved to the file endpoint.
Generated with Claude Code