Skip to content

twocaretcat/watch-history-exporter-for-amazon-prime-video

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

85 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
Project logo

Watch History Exporter for Amazon Prime Video

Project category Language Repository size Project license

Latest release

A script to export your Amazon Prime Video watch history as a JSON or CSV file.


๐Ÿ‘‹ About

This script runs in your browser and allows you to save your watch history from Amazon Prime Video to a JSON or CSV file, where it can be processed further or imported into other platforms.

Features

  • โšก Browser-based: Run the script directly in your browser, no installation required
  • ๐Ÿ“ฅ Detailed export: Save your complete watch history as a JSON or CSV file with the following columns:
    • Date Watched (date and time)
    • Type (movie or TV show)
    • Title
    • Episode Title (for TV shows)
    • Global Title Identifier (GTI)
    • Episode Global Title Identifier (GTI)
    • Path (URL)
    • Episode Path (URL)
    • Image URL
  • ๐ŸŒ Multi-language support1: Built-in support for every language supported by Amazon Prime
  • โš™๏ธ Flexible configuration: Power users can easily modify values used by the script to suit their needs, like:

1 Column names will still be in English, but you can easily edit the values in the script or resulting file if you wish.

Example Output

CSV

"Date Watched","Type","Title","Episode Title","Global Title Identifier","Episode Global Title Identifier","Path","Episode Path","Image URL"
"2025-09-28 02:00:24.173","Series","The Terminal List: Dark Wolf - Season 1","Episode 1: ""INHERENT RESOLVE""","amzn1.dv.gti.83c8ce44-b42e-40fd-8546-c36fd2824071","amzn1.dv.gti.16c010ce-0da6-42fb-b031-13dfa43105b6","/region/na/detail/0MYH9XYR9SCGXB57LR8ES71GFL/ref=atv_set_wh_dp","/region/na/detail/0GI3HHV1BYZKGSIE8EEPCUPUPI/ref=atv_set_wh_dp","https://images-na.ssl-images-amazon.com/images/S/pv-target-images/4b6e6de10b8cda8efd7b42419c2cf4c82649a44dc7a03528f28f7cd9280d4b46._UX667_UY375_SY200_.jpg"
"2023-10-03 04:06:31.437","Movie","Everything Everywhere All at Once","","amzn1.dv.gti.9d433401-4b4f-4737-9ec7-ce92e6b313f2","","/region/na/detail/0OGS49QMOKJSEBRYHCDSWSP8MQ/ref=atv_set_wh_dp","","https://m.media-amazon.com/images/S/pv-target-images/bba149329b86df530aaa47625125cafd766fc14fde4867e2d067afea0f4faadd._UX667_UY375_SY200_.jpg"

JSON (with date formatting disabled):

[
	{
		"dateWatched": 1759024824173,
		"type": "Series",
		"title": "The Terminal List: Dark Wolf - Season 1",
		"episodeTitle": "Episode 1: \"INHERENT RESOLVE\"",
		"id": "amzn1.dv.gti.83c8ce44-b42e-40fd-8546-c36fd2824071",
		"episodeId": "amzn1.dv.gti.16c010ce-0da6-42fb-b031-13dfa43105b6",
		"path": "/region/na/detail/0MYH9XYR9SCGXB57LR8ES71GFL/ref=atv_set_wh_dp",
		"episodePath": "/region/na/detail/0GI3HHV1BYZKGSIE8EEPCUPUPI/ref=atv_set_wh_dp",
		"imageUrl": "https://images-na.ssl-images-amazon.com/images/S/pv-target-images/4b6e6de10b8cda8efd7b42419c2cf4c82649a44dc7a03528f28f7cd9280d4b46._UX667_UY375_SY200_.jpg"
	},
	{
		"dateWatched": 1696305991437,
		"type": "Movie",
		"title": "Everything Everywhere All at Once",
		"episodeTitle": "",
		"id": "amzn1.dv.gti.9d433401-4b4f-4737-9ec7-ce92e6b313f2",
		"episodeId": "",
		"path": "/region/na/detail/0OGS49QMOKJSEBRYHCDSWSP8MQ/ref=atv_set_wh_dp",
		"episodePath": "",
		"imageUrl": "https://images-na.ssl-images-amazon.com/images/S/pv-target-images/bba149329b86df530aaa47625125cafd766fc14fde4867e2d067afea0f4faadd._UX667_UY375_SY200_.jpg"
	}
]

How it Works

Pasting the script into your your browser's console lets it interact with the page and extract watch history like so:

  1. The first chunk of watch history data is delivered with the page as a JSON string embedded in a <script type="text/template"> tag. The script finds and extracts this data and parses it into a JavaScript object
  2. The rest of the watch history is loaded with API calls when you scroll down the page. To get this data, we monkey-patch the built-in fetch to listen for responses containing the desired data
  3. To actually make the API calls, we simulate scrolling to the bottom of the page
  4. Once all data is loaded, we construct a CSV file and trigger a download using a data URL

Previous versions of this script parsed the DOM directly, but the data available in the DOM is not as complete and adding support for multiple languages requires writing a lot of extra code for handling locale-specific dates and other strings.

๐Ÿ•น๏ธ Usage

Caution

For security reasons, I do not recommend running scripts from the internet unless you understand what they are doing. If you are not a developer, I recommend reading the comments in the code and/or asking a LLM like ChatGPT to explain it to you.

Warning

Don't scroll down the page before you run the script. Scrolling will cause new items to be loaded before the script is able to see them, meaning there will be missing movies/shows in the output. I recommend reloading the page and then running the script.

Instructions:

  1. Open primevideo.com/settings/watch-history in your browser
  2. Open your browser's devtools console (how?)
  3. Copy the code in watch-history-exporter-for-amazon-prime-video.js and paste it into the console. If this doesn't work or you see a warning message about pasting, see the FAQ.
  4. Press enter to run the script. You should see the script running in the console and you'll be prompted to save a file when it finishes. If this doesn't happen, see the FAQ.

Columns

Column Description
Date Watched When the item was watched. Stored as a timestamp or formatted date, depending on configuration.
Type Whether the item is a movie or a series episode.
Title The movie title or series name.
Episode Title The episode title (empty for movies).
Global Title Identifier Amazonโ€™s internal unique identifier for the movie or series.
Episode Global Title Identifier Amazonโ€™s internal unique identifier for the episode (empty for movies).
Path Prime Video URL path for the movie or series. To get the full URL, prepend https://www.primevideo.com to this value.
Episode Path Prime Video URL path for the episode (empty for movies). To get the full URL, prepend https://www.primevideo.com to this value.
Image URL URL of the poster or thumbnail image.

๐Ÿค– Advanced Usage

There are several constants at the top of the script that can be used to tweak the script's behavior to suit your needs.

Interactivity

By default, the script will prompt you when something goes awry so you can decide if you want to continue or not.

If you want to run the script programmatically or you don't care about warnings, you can change the OPTION.interactive variable at the top of the script from true to false to automatically continue when warnings are displayed.

Output Format

Note

CSV files have human-readable column names, while JSON files have machine-readable property names.

By default, the output is saved as a CSV file. If you prefer JSON, change the OPTION.outputJson variable at the top of the script from false to true.

JSON uses tabs to indent the output by default, but you can change this to an empty string for a smaller file size or spaces if you prefer those.

Output Filename

Note

The file extension will be added automatically.

By default, the output filename is watch-history-export-<timestamp>. You can change this by modifying the OPTION.outputFilename variable at the top of the script.

Date Formats

By default, dates and times are saved in an RFC 3339-like format like yyyy-mm-dd hh:mm:ss.sss. Dates in this format are human-readable and easily understood by most spreadsheet programs.

If you plan on using the CSV data programmatically, you can instead output raw Unix Timestamps like 1759024824173. Note that this is in milliseconds.

To do this, change the OPTION.formatDates variable at the top of the script from true to false.

Custom Delimiters

Note

The default values were chosen because they are compatible and auto-detected by most spreadsheet programs. They have also been tested to make sure things like weird movie titles don't break the output. Changing delimiters has the potential to cause issues.

The DELIMITERS constant at the top of the file contains various delimiters used in the CSV file. By default, we use " to separate strings, , to separate columns, and \n (newline) to separate rows. \t (tab) is used to separate JSON objects when exporting as JSON. If you want to use different delimiters, you can customize the values here.

Custom Column Names

The MSG constant at the top of the file contains column names and values. If you want the CSV to be in a different language, you can customize these values.

Alternatively, you can use a text editor or spreadsheet program to rename the columns after the CSV is generated.

๐Ÿ›Ÿ Support

Need help? See the support resources for information on how to:

  • request features
  • report bugs
  • ask questions
  • report security vulnerabilities

Some solutions to common issues are also listed below.

FAQ

Nothing shows up when I paste in the console / I get a warning when I try to paste in the console

Some browsers prevent you from pasting code in the console because it could be malicious. This is called Paste Protection and you can read more about it on the Chrome for Developers Blog.

If this happens, follow the instructions in the console to re-enable pasting, and then try again. For Chrome, the following steps should work:

  1. Try to paste something in the console. You should get a warning message about pasting
  2. Type "allow pasting" in the console and press enter

See this video for a visual walkthrough.

I get an Uncaught SyntaxError: Unexpected identifier error when running the script

Make sure that you select the entire file with Ctrl + A when copying it. If part of the script is cut off, it won't work.

The script runs, but I am not prompted to save a file

If you have a default download folder set, check if the file is there.

Otherwise, make sure "Pop-ups and redirects" and "Automatic downloads" are enabled for <www.primevideo.com> in your browser settings.

Something else is broken

If you can't get things working, you can try running an older version of the script. v2.1.0 uses a different method to export your watch history than the current version, so it may work if the current version doesn't.

๐Ÿค Contributing

Want to help out? Pull requests are welcome for:

  • feature implementations
  • bug fixes
  • translations
  • documentation
  • tests

See the contribution guide for more details.

๐Ÿงพ License

Copyright ยฉ 2026 John Goodliff (@twocaretcat).

This project is released into the public domain (attribution is appreciated but not required ๐Ÿ™‚). See the license for details.

๐Ÿ’• Funding

Find this project useful? Sponsoring me will help me cover costs and commit more time to open-source.

If you can't donate but still want to contribute, don't worry. There are many other ways to help out, like:

  • ๐Ÿ“ข reporting (submitting feature requests & bug reports)
  • ๐Ÿ‘จโ€๐Ÿ’ป coding (implementing features & fixing bugs)
  • ๐Ÿ“ writing (documenting & translating)
  • ๐Ÿ’ฌ spreading the word
  • โญ starring the project

I appreciate the support!