This command-line tool downloads Reddit submissions and comments, reconstructs comment trees, and exports the result as CSV, JSON, or both. It does not require a database.
It uses one of two sources depending on the requested dates:
.zst archive files are downloaded from the supplied Academic Torrents torrent with libtorrent.The tool can combine both sources when a date range crosses the boundary.
The project is set up for Python 3.9. Use a 64-bit Python/Conda installation on a typical 64-bit Windows PC.
Already have a working 64-bit Python 3.9 environment? You may skip the Miniconda installation and Conda environment-creation steps, activate your existing Python 3.9 virtual environment instead, and continue at Step 4. Any other method of running Python 3.9 is also fine. Do not use a newer Python version: this project's
libtorrentdependency is intended to run with Python 3.9. If you are unsure which Python version or environment you have, follow the Miniconda steps below.
In Anaconda Prompt, run:
cd "C:\reddit download script\reddit_data_downloader_tool"
If you saved the project elsewhere, replace that path with its actual location.
conda create --name reddit-downloader python=3.9 pip -y
conda activate reddit-downloader
You should now see (reddit-downloader) at the beginning of the prompt. Activate this environment again whenever you want to run the tool.
Install libtorrent first, then the package that provides its required OpenSSL DLLs on Windows:
python -m pip install --upgrade pip
python -m pip install libtorrent
python -m pip install libtorrent-windows-dll
The second package prevents the common ImportError: DLL load failed while importing libtorrent error. It installs libcrypto-1_1-x64.dll and libssl-1_1-x64.dll alongside the libtorrent package.
Verify that libtorrent imports successfully:
python -c "import libtorrent as lt; print('libtorrent version:', lt.version)"
If this command prints a version number, continue. If it reports a DLL error, confirm that you are using the activated reddit-downloader environment, then rerun the two libtorrent install commands above.
python -m pip install -r requirements.txt
The requirements file also includes the Windows DLL helper, so this command is safe to rerun later to repair or update the environment.
From the project directory, with the environment active, start the program:
conda activate reddit-downloader
python downloader.py
Answer the prompts as follows:
Subreddit name(s): Enter one subreddit name or several comma-separated names. Do not include r/.
Fiverr, Upwork
Start date: Enter YYYY-MM-DD, for example 2025-01-01.
End date: Enter YYYY-MM-DD, for example 2025-02-01. The end date is an exclusive boundary, so this example requests data from 1 January up to, but not including, 1 February.
Export format: choose one of the following:
1 - CSV: flat rows for posts and comments, including available raw fields.2 - JSON: posts with nested comment and reply trees.3 - both CSV and JSON.The program reports which source it will use, downloads the required data, reads it into memory, and writes the export files when finished. Keep the terminal open until it displays EXPORT COMPLETE.
Any requested date before 2026-01-01 UTC needs the reddit-archives.torrent file in the project folder.
Check whether reddit-archives.torrent is already beside downloader.py. This project currently includes one.
If it is missing, download the appropriate Reddit archive .torrent file from Academic Torrents.
Rename the downloaded file exactly to reddit-archives.torrent.
Put it in the project root:
C:\reddit download script\reddit_data_downloader_tool\reddit-archives.torrent
Run python downloader.py and enter the historical date range. If the file is missing, the program pauses and asks you to add it before continuing.
The torrent downloader searches the torrent metadata for files named <subreddit>_submissions.zst and <subreddit>_comments.zst, then prioritizes only those matching files. Download speed and availability depend on the torrent's peers.
The tool includes native support for seeding downloaded .zst files back to the Academic Torrents network to keep them available and fast for other researchers.
.zst files in your downloads/ folder), downloader.py will ask if you would like to run a background seeder.seeder.pyw) is spawned using pythonw.exe on Windows (which has no visible command window) or standard background threads on macOS/Linux.6h for 6 hours, 2d for 2 days).seeder.lock). If the downloader runs and detects that a seeder is already active in the background, it will skip asking and avoid launching duplicate background processes.seeder.log.downloads\ - cached source files: .zst torrent archives and/or .jsonl API responses.reddit_export_YYYYMMDD_HHMMSS.csv - CSV export, when you choose CSV or both.reddit_export_YYYYMMDD_HHMMSS.json - reconstructed nested JSON export, when you choose JSON or both.Exports are written to the project folder. Cached downloads are retained, so remove them manually only if you no longer need them.
More data categories and optional PRAW support may be added in the future.
If you try the tool, feedback is welcome. In particular, please report whether it works in your environment, whether the installation instructions are clear, and any errors you encounter. Open an issue or send a message with the error details, your operating system, Python version, and the command you ran so the problem can be reproduced and fixed.
| Problem | What to do |
|---|---|
conda is not recognized | Use Anaconda Prompt, or finish/restart after the Miniconda installation. |
DLL load failed while importing libtorrent | Activate reddit-downloader, then run python -m pip install --force-reinstall libtorrent libtorrent-windows-dll. |
No matching files found | Check the spelling of each subreddit and make sure the torrent contains archive files for it. |
| Torrent download makes no progress | Leave it running for peer discovery; availability depends on active peers and trackers. |
| No records found | Check the subreddit name and date range; data may not be available from the chosen source. |
6 commits
Python
100.0%
This command-line tool downloads Reddit submissions and comments, reconstructs comment trees, and exports the result as CSV, JSON, or both. It does not require a database.
It uses one of two sources depending on the requested dates:
.zst archive files are downloaded from the supplied Academic Torrents torrent with libtorrent.The tool can combine both sources when a date range crosses the boundary.
The project is set up for Python 3.9. Use a 64-bit Python/Conda installation on a typical 64-bit Windows PC.
Already have a working 64-bit Python 3.9 environment? You may skip the Miniconda installation and Conda environment-creation steps, activate your existing Python 3.9 virtual environment instead, and continue at Step 4. Any other method of running Python 3.9 is also fine. Do not use a newer Python version: this project's
libtorrentdependency is intended to run with Python 3.9. If you are unsure which Python version or environment you have, follow the Miniconda steps below.
In Anaconda Prompt, run:
cd "C:\reddit download script\reddit_data_downloader_tool"
If you saved the project elsewhere, replace that path with its actual location.
conda create --name reddit-downloader python=3.9 pip -y
conda activate reddit-downloader
You should now see (reddit-downloader) at the beginning of the prompt. Activate this environment again whenever you want to run the tool.
Install libtorrent first, then the package that provides its required OpenSSL DLLs on Windows:
python -m pip install --upgrade pip
python -m pip install libtorrent
python -m pip install libtorrent-windows-dll
The second package prevents the common ImportError: DLL load failed while importing libtorrent error. It installs libcrypto-1_1-x64.dll and libssl-1_1-x64.dll alongside the libtorrent package.
Verify that libtorrent imports successfully:
python -c "import libtorrent as lt; print('libtorrent version:', lt.version)"
If this command prints a version number, continue. If it reports a DLL error, confirm that you are using the activated reddit-downloader environment, then rerun the two libtorrent install commands above.
python -m pip install -r requirements.txt
The requirements file also includes the Windows DLL helper, so this command is safe to rerun later to repair or update the environment.
From the project directory, with the environment active, start the program:
conda activate reddit-downloader
python downloader.py
Answer the prompts as follows:
Subreddit name(s): Enter one subreddit name or several comma-separated names. Do not include r/.
Fiverr, Upwork
Start date: Enter YYYY-MM-DD, for example 2025-01-01.
End date: Enter YYYY-MM-DD, for example 2025-02-01. The end date is an exclusive boundary, so this example requests data from 1 January up to, but not including, 1 February.
Export format: choose one of the following:
1 - CSV: flat rows for posts and comments, including available raw fields.2 - JSON: posts with nested comment and reply trees.3 - both CSV and JSON.The program reports which source it will use, downloads the required data, reads it into memory, and writes the export files when finished. Keep the terminal open until it displays EXPORT COMPLETE.
Any requested date before 2026-01-01 UTC needs the reddit-archives.torrent file in the project folder.
Check whether reddit-archives.torrent is already beside downloader.py. This project currently includes one.
If it is missing, download the appropriate Reddit archive .torrent file from Academic Torrents.
Rename the downloaded file exactly to reddit-archives.torrent.
Put it in the project root:
C:\reddit download script\reddit_data_downloader_tool\reddit-archives.torrent
Run python downloader.py and enter the historical date range. If the file is missing, the program pauses and asks you to add it before continuing.
The torrent downloader searches the torrent metadata for files named <subreddit>_submissions.zst and <subreddit>_comments.zst, then prioritizes only those matching files. Download speed and availability depend on the torrent's peers.
The tool includes native support for seeding downloaded .zst files back to the Academic Torrents network to keep them available and fast for other researchers.
.zst files in your downloads/ folder), downloader.py will ask if you would like to run a background seeder.seeder.pyw) is spawned using pythonw.exe on Windows (which has no visible command window) or standard background threads on macOS/Linux.6h for 6 hours, 2d for 2 days).seeder.lock). If the downloader runs and detects that a seeder is already active in the background, it will skip asking and avoid launching duplicate background processes.seeder.log.downloads\ - cached source files: .zst torrent archives and/or .jsonl API responses.reddit_export_YYYYMMDD_HHMMSS.csv - CSV export, when you choose CSV or both.reddit_export_YYYYMMDD_HHMMSS.json - reconstructed nested JSON export, when you choose JSON or both.Exports are written to the project folder. Cached downloads are retained, so remove them manually only if you no longer need them.
More data categories and optional PRAW support may be added in the future.
If you try the tool, feedback is welcome. In particular, please report whether it works in your environment, whether the installation instructions are clear, and any errors you encounter. Open an issue or send a message with the error details, your operating system, Python version, and the command you ran so the problem can be reproduced and fixed.
| Problem | What to do |
|---|---|
conda is not recognized | Use Anaconda Prompt, or finish/restart after the Miniconda installation. |
DLL load failed while importing libtorrent | Activate reddit-downloader, then run python -m pip install --force-reinstall libtorrent libtorrent-windows-dll. |
No matching files found | Check the spelling of each subreddit and make sure the torrent contains archive files for it. |
| Torrent download makes no progress | Leave it running for peer discovery; availability depends on active peers and trackers. |
| No records found | Check the subreddit name and date range; data may not be available from the chosen source. |
6 commits
Python
100.0%