Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

دانلودکننده GoFile برای Google Colab

این پروژه یک نوت‌بوک Google Colab برای دریافت فایل از پوشه‌های اشتراکی GoFile است.

امکانات

  • دانلود فقط یک فایل مشخص با شناسه (File ID)
  • دانلود تمام فایل‌های پوشه به‌صورت بازگشتی، شامل زیرپوشه‌ها
  • ذخیره مستقیم در Google Drive
  • ادامه دانلود ناقص با فایل موقت .part، در صورت پشتیبانی سرور از HTTP Range
  • بررسی اندازه فایل
  • بررسی MD5 در حالت تک‌فایلی، در صورت واردکردن هش مورد انتظار
  • استفاده از MD5 موجود در اطلاعات فایل در حالت دانلود کل پوشه، اگر API آن را ارائه کند
  • تلاش مجدد هنگام خطاهای موقت شبکه

شروع سریع

  1. فایل GoFile_Colab_Downloader.ipynb را دانلود کنید.
  2. وارد Google Colab شوید.
  3. از مسیر File → Upload notebook نوت‌بوک را بارگذاری کنید.
  4. در ابتدای سلول، تنظیمات را تغییر دهید.
  5. کل سلول را اجرا کنید و اجازه دسترسی به Google Drive را بدهید.

تنظیمات اصلی

در ابتدای سلول:

FOLDER_URL = "https://gofile.io/d/YOUR_FOLDER_CODE"
DOWNLOAD_MODE = "single"  # یا "all"
TARGET_FILE_ID = "YOUR_FILE_ID"
SAVE_DIR = "/content/drive/MyDrive/GoFile"

حالت اول: فقط یک فایل خاص

مقدار DOWNLOAD_MODE را روی single بگذارید و شناسه دقیق فایل را وارد کنید:

DOWNLOAD_MODE = "single"
TARGET_FILE_ID = "0fb595d7-3241-41d2-8535-8a29e52bf33f"

EXPECTED_NAME = "example.zip"  # اختیاری
EXPECTED_SIZE = 123456789       # اختیاری
EXPECTED_MD5 = "..."            # اختیاری

اگر نام، اندازه یا MD5 را نمی‌دانید، مقدار مربوط را None بگذارید. برای جلوگیری از انتخاب اشتباه، شناسه فایل همچنان الزامی است.

نکته: برنامه در این حالت فقط همان شناسه را پیدا و دانلود می‌کند؛ فایل‌های دیگر پوشه دانلود نمی‌شوند.

حالت دوم: دانلود تمام فایل‌های پوشه

DOWNLOAD_MODE = "all"
TARGET_FILE_ID = ""

در این حالت برنامه ساختار پوشه را به‌صورت بازگشتی می‌خواند و همه فایل‌ها را با حفظ ساختار زیرپوشه‌ها در Google Drive ذخیره می‌کند.

ادامه دانلود

اگر اجرای Colab یا ارتباط اینترنت قطع شود، داده دریافت‌شده در فایل .part باقی می‌ماند. با اجرای دوباره سلول، برنامه اندازه فایل موقت را بررسی می‌کند و در صورت پشتیبانی سرور از درخواست Range، ادامه را از همان نقطه انجام می‌دهد. اگر سرور درخواست ادامه را نپذیرد، ممکن است دانلود از ابتدا آغاز شود.

MD5 و صحت فایل

  • در حالت تک‌فایلی، با تنظیم EXPECTED_MD5 مقدار محاسبه‌شده با هش مورد انتظار مقایسه می‌شود.
  • در حالت کل پوشه، اگر API برای فایل مقدار md5 برگرداند، همان مقدار بررسی می‌شود.
  • اگر هش در دسترس نباشد، برنامه فقط اندازه فایل را کنترل می‌کند؛ تطبیق اندازه به‌تنهایی تضمین کامل سلامت محتوا نیست.

محدودیت‌ها و نکات مهم

  • این پروژه به API و رفتار فعلی GoFile وابسته است؛ GoFile ممکن است احراز هویت، توکن وب، محدودیت نرخ درخواست یا ساختار پاسخ API را تغییر دهد.
  • روش ساخت Website Token و مقدار salt در این نسخه بر اساس کدی است که در یک اجرای واقعی توسط سازنده پروژه با موفقیت استفاده شده است؛ پایداری آینده آن تضمین‌شده نیست.
  • دانلود پوشه‌های بزرگ به فضای خالی کافی در Google Drive و زمان اجرای کافی در Colab نیاز دارد.
  • در حالت کل پوشه، ممکن است محدودیت صفحه‌بندی API برای پوشه‌هایی با تعداد بسیار زیاد فرزند نیاز به توسعه داشته باشد.
  • فایل‌های ناقص با پسوند .part نگهداری می‌شوند؛ آن‌ها را تا پایان دانلود حذف نکنید.
  • فقط محتوایی را دانلود کنید که اجازه دسترسی و دریافت آن را دارید.

وضعیت آزمایش

  • حالت تک‌فایلی: کد مبنا با یک فایل ZIP حدود ۵٫۶۲ گیگابایتی در Google Colab اجرا شده و دانلود و MD5 آن موفق بوده است.
  • نسخه عمومی قابل تنظیم: برای انتشار، کد مبنا پارامتری شده است؛ نسخه عمومی باید روی لینک‌ها و فایل‌های دیگر نیز آزمایش شود.
  • حالت دانلود کل پوشه: به‌عنوان قابلیت افزوده‌شده ارائه شده و در این مخزن ادعای آزمایش مستقل روی همه انواع پوشه‌های GoFile نمی‌شود.

مجوز

این پروژه تحت مجوز MIT منتشر شده است. متن کامل در فایل LICENSE قرار دارد.


GoFile Colab Downloader

A Google Colab notebook for downloading files from GoFile shared folders.

Features

  • Download one exact file by its GoFile file ID
  • Download every file in a shared folder recursively, including nested folders
  • Save directly to Google Drive
  • Resume partial downloads using HTTP Range when supported by the server
  • Verify file size
  • Verify MD5 when an expected hash is supplied or returned by the API
  • Retry transient network failures

Quick start

  1. Download GoFile_Colab_Downloader.ipynb.
  2. Open Google Colab.
  3. Select File → Upload notebook and upload the notebook.
  4. Edit the settings at the top of the code cell.
  5. Run the cell and authorize Google Drive access.

Main settings

FOLDER_URL = "https://gofile.io/d/YOUR_FOLDER_CODE"
DOWNLOAD_MODE = "single"  # or "all"
TARGET_FILE_ID = "YOUR_FILE_ID"
SAVE_DIR = "/content/drive/MyDrive/GoFile"

Download one specific file

Set:

DOWNLOAD_MODE = "single"
TARGET_FILE_ID = "YOUR_EXACT_FILE_ID"

EXPECTED_NAME = "example.zip"  # optional
EXPECTED_SIZE = 123456789       # optional
EXPECTED_MD5 = "..."            # optional

Set optional expected values to None if unknown. The exact file ID is required. In this mode, other files in the shared folder are not downloaded.

Download all files in a folder

Set:

DOWNLOAD_MODE = "all"
TARGET_FILE_ID = ""

The notebook walks nested folders recursively and saves files while preserving their relative folder structure.

Resume behavior

Partial data is kept in a .part file. On rerun, the notebook attempts to continue from the existing byte offset using an HTTP Range request. This depends on the download server honoring Range requests; otherwise a fresh download may be required.

Integrity checks

  • Single-file mode compares MD5 when EXPECTED_MD5 is provided.
  • Folder mode checks MD5 when the GoFile API returns an md5 value for a file.
  • If no MD5 is available, the notebook checks the downloaded size only. Matching size alone is not a full integrity guarantee.

Limitations

  • The implementation depends on GoFile's API and website-token behavior, which may change.
  • The Website Token construction and salt in this version are based on the code supplied by the project owner and used successfully in one real Colab download. Future compatibility is not guaranteed.
  • Large folder downloads require sufficient Google Drive storage and Colab runtime time.
  • Very large folders may require additional API pagination handling.
  • Keep .part files until downloads finish.
  • Only download content you are authorized to access.

Test status

  • Single-file baseline: The supplied baseline successfully downloaded a roughly 5.62 GB ZIP in Google Colab and verified its MD5.
  • Generalized notebook: The baseline has been parameterized for public use; it should be exercised against other folders and files.
  • Recursive folder mode: Added as a convenience feature; this repository does not claim independent testing against every GoFile folder structure.

License

MIT. See LICENSE.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages