DEV Community

Damantha Jasinghe
Damantha Jasinghe

Posted on

🚀How to Download files from Terabox with Python

Tired of navigating clunky download links or struggling with Terabox file sharing? Say hello to terabox-downloader, a powerful and beginner-friendly Python package that simplifies your file interactions with Terabox. Whether you’re a bot developer, data hoarder, or just a curious Pythonista, this tool gives you direct access to Terabox file metadata and lets you download files with custom progress tracking — all in a few lines of code.

Let’s break down what it does and how to get started.


🌟 Features

  • 🔗 Get direct download links from Terabox.
  • 📝 View file name, size, and thumbnail.
  • 📥 Download files to any folder.
  • 📊 Add a built-in or custom progress bar.
  • ❌ Helpful error handling for smoother scripting.
  • 🐍 Compatible with Python 3.7+.

⚙️ Installation

pip install terabox-downloader


🍪 How to Get Your Cookie

To interact with Terabox, you’ll need your account’s cookie — a quick one-time setup.

  • Open Edge and log in to your Terabox account.
  • Click the padlock🔒 in the address bar → “Permissions for this site”.
  • Head to Cookies and site data → Cookies in use.
  • Find the lang and ndus cookies under terabox.com.
  • Combine them like this:

cookie = "lang=en; ndus=YOUR_VALUE_HERE;"

💡 Need help? Here’s a visual guide.


🚀 Quick Start

from TeraboxDL import TeraboxDL

# Step 1: Add your Terabox cookie
cookie = "lang=en; ndus=YOUR_COOKIE_HERE;"

# Step 2: Create the client
terabox = TeraboxDL(cookie)

# Step 3: Provide a file link
link = "https://www.terabox.app/s/your_link_here"

# Step 4: Fetch file info
file_info = terabox.get_file_info(link)

# Step 5: Show the results
if "error" in file_info:
    print("Error:", file_info["error"])
else:
    print("Name:", file_info["file_name"])
    print("Size:", file_info["file_size"])
    print("Thumbnail:", file_info["thumbnail"])
    print("Link:", file_info["download_link"])

Enter fullscreen mode Exit fullscreen mode

📂 Downloading Files

Now let's download that file!

result = terabox.download(file_info, save_path="downloads/")

if "error" in result:
    print("Download Error:", result["error"])
else:
    print("✅ File downloaded to:", result["file_path"])
Enter fullscreen mode Exit fullscreen mode

🧪 Custom Progress Bar

Add a custom progress bar for better UI integration:

def progress_callback(downloaded, total_size, percentage):
    done = int(50 * downloaded / total_size)
    print(f"\r[{'=' * done}{' ' * (50 - done)}] {percentage:.2f}%", end='')

terabox.download(file_info, save_path="downloads/", callback=progress_callback)
Enter fullscreen mode Exit fullscreen mode

Use this in bots, GUI apps, terminal tools, or anywhere you want real-time feedback!


✅ Why You’ll Love It

Whether you're automating downloads, building a bot, or scraping data, terabox-downloader is a clean and powerful tool for Python devs. It brings simplicity to something that’s often annoying — dealing with file sharing platforms.

🔗 GitHub Repo


If you found this helpful, consider starring the GitHub repo or following for more dev tools and tips!

Top comments (1)

Collapse
 
ordigital profile image
Adam Mateusz Brożyński

Thanks! :)