Prepare the example
You need Node.js 20 or newer, an API key, and permission to use the media. Clone the runnable files:--convert, the script saves metadata and downloads a direct MP4 if one is available. If Amazon exposes only HLS playlists, it saves the metadata without charging for conversion. To authorize conversion of one playlist, add the explicit flag:
:mp4 conversion suffix also fits the API’s idempotency header limit.
Run the complete workflow
The bundledclient.mjs sends credentials only to AmzDownloader, rejects redirects and applies request timeouts. The extraction call enables productVideos and disables the other groups. It accepts either an immediate completed response or a queued job, with at most 20 polls separated by three seconds.
download-videos.mjs
media-result.json before attempting a download. A successful selected download is saved as video-001.mp4; that file is not overwritten. The 64 MB download limit and polling budget belong to this example. They are not promises about maximum source-video size or extraction latency.
Understand the media response
Readdata.media.productVideos for the requested product-gallery group. Each item can include title, cover, src, duration, group, contentType and optional creator metadata. Read data.source.asin, data.source.marketplace, data.source.fetchedAt, data.counts and data.warnings alongside it.
Related, customer-review and creator videos can be classified separately. This example does not request related or creator groups. To include them, deliberately change the request flags and inspect each video’s group; do not assume that every returned video depicts the selected product.
Keep conversion and download separate
A supported.m3u8 conversion request uses POST /videos/convert. Its MP4 download location is the response’s top-level url, not data.url. A direct MP4 source does not need conversion. Download the returned URL without an AmzDownloader authorization header.
One successful extraction costs one credit, including a cache hit. One successful conversion costs one additional credit, including a cached conversion. Polling, owned result reads, failures and identical idempotent replays add no credits. If a download fails after the API succeeded, use the saved metadata before requesting more work.
If polling ends locally, retain the printed job ID and check its status later. Do not submit a new extraction simply to check progress. See the conversion API overview, conversion guide, errors, the video API overview and the public examples repository.