Skip to content

About

Static Site Exporter

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Static Site Exporter

Türkçe · English

Lisans: MIT Python 3.10+

Türkçe

PHP, Laravel, WordPress veya başka bir sunucu taraflı sistem tarafından üretilen ziyaretçi sayfalarını statik HTML dosyalarına dönüştüren Python aracıdır. Yönetim paneli yolları tarama dışında bırakılabilir.

Important

Bu aracı yalnızca sahibi olduğunuz veya statik kopyasını oluşturma izniniz bulunan web sitelerinde kullanın.

Özellikler

  • Aynı alan adına ait HTML sayfalarını tarar.
  • HTTP/HTTPS ve www/non-www geçişlerini aynı site olarak değerlendirir.
  • HTML meta refresh yönlendirmelerini takip eder.
  • CSS, JavaScript, görsel, font, ses ve video varlıklarını indirir.
  • HTML bağlantılarını, srcset ve CSS url(...) yollarını yeniden yazar.
  • Yönetim paneli ve diğer özel yolların hariç tutulmasını destekler.
  • Sorgu parametreli adresleri dosya çakışması olmadan kaydeder.
  • Sayfa limiti, istek gecikmesi, zaman aşımı ve özel User-Agent sunar.

Gereksinimler

  • Python 3.10 veya üzeri
  • İnternetten erişilebilen ya da yerel ağda çalışan bir web sitesi

Kurulum

Proje klasörüne girin:

cd static-site-exporter

İsteğe bağlı olarak sanal ortam oluşturun ve etkinleştirin:

python -m venv .venv
source .venv/bin/activate

Bağımlılıkları yükleyin:

python -m pip install -r requirements.txt

Temel kullanım

python export_site.py https://example.com

Protokol yazılmazsa https:// kullanılır:

python export_site.py example.com

Varsayılan çıktı klasörü alan adıdır. Örneğin yukarıdaki komut dosyaları example.com klasörüne yazar.

Çıktı klasörünü seçme

python export_site.py https://example.com --output site-ciktisi

Kısa seçenek de kullanılabilir:

python export_site.py https://example.com -o site-ciktisi

Yönetim panelini hariç tutma

--exclude verilmezse şu yollar otomatik olarak hariç tutulur:

  • /admin
  • /yonetim
  • /panel
  • /login

Özel yollar verildiğinde bunlar varsayılan listenin yerine geçer:

python export_site.py https://example.com \
  --exclude /admin \
  --exclude /uye \
  --exclude /sepet

Tek satır örneği:

python export_site.py https://example.com --exclude /admin --exclude /uye --exclude /sepet

Belirtilen yol ve tüm alt yolları dışarıda bırakılır. Örneğin /admin, /admin/users adresini de engeller.

Diğer seçenekler

En fazla 250 sayfa taramak için:

python export_site.py https://example.com --max-pages 250

Sunucuyu yormamak için istekler arasında yarım saniye beklemek üzere:

python export_site.py https://example.com --delay 0.5

İstek zaman aşımını 60 saniye yapmak için:

python export_site.py https://example.com --timeout 60

Yerel geliştirme ortamındaki geçersiz/kendinden imzalı TLS sertifikasını kabul etmek için:

python export_site.py https://localhost --insecure

Tüm seçenekleri görmek için:

python export_site.py --help

Çıktıyı görüntüleme

Statik klasörü doğrudan çift tıklayarak açmak yerine bir HTTP sunucusu üzerinden görüntülemek daha güvenilirdir:

cd site-ciktisi
python -m http.server 8000

Ardından tarayıcıda http://localhost:8000 adresini açın.

Neleri indirir?

  • Aynı alan adındaki HTML sayfaları
  • Görseller, JavaScript, CSS, font, video ve ses gibi bağlantılı varlıklar
  • srcset içindeki görseller
  • CSS dosyalarındaki url(...) ile belirtilen yerel varlıklar
  • HTML içindeki meta refresh yönlendirmeleri

HTML bağlantıları ve indirilen varlık yolları çevrimdışı yapıya uygun şekilde yeniden yazılır. Sorgu parametreli adreslerin dosya adlarına kısa bir özet değeri eklenir; böylece farklı içerikler birbirinin üzerine yazılmaz.

HTTP/HTTPS geçişleri ile www.example.com ve example.com adresleri aynı site olarak kabul edilir. Bu sayede sitenin kanonik adrese yönlendirme yapması taramayı ilk sayfada durdurmaz.

Sınırlamalar

  • PHP kodu ve veritabanı statik çıktıda çalışmaz; yalnızca dışa aktarma anındaki oluşturulmuş HTML kaydedilir.
  • Formlar, arama, oturum açma, ödeme, sepet ve üyelik gibi sunucu taraflı işlemler statik kopyada çalışmaz.
  • JavaScript çalıştıktan sonra ekrana gelen içerik yakalanmaz. Böyle sitelerde Playwright veya Selenium tabanlı bir tarayıcı gerekir.
  • Başka alan adlarında/CDN'lerde bulunan varlıklar indirilmez ve dış bağlantı olarak bırakılır.
  • Giriş gerektiren sayfalar için bu sürüm oturum açmaz.
  • Site sahibinin izni, kullanım koşulları ve telif hakları gözetilmelidir.

İşlemi mümkünse canlı sistem yerine yerel veya staging kopyasında çalıştırın.

Profesyonel destek

Özel dışa aktarma akışları, kimlik doğrulamalı siteler, JavaScript ile oluşturulan sayfalar, büyük ölçekli site taşıma işlemleri ve yayınlama entegrasyonları için profesyonel destek sunuyorum. İhtiyacınızı görüşmek için ayrıntıları içeren bir GitHub issue açabilirsiniz.

Katkıda bulunma

Katkılarınızı bekliyoruz. Büyük bir değişikliğe başlamadan önce bir issue açın, değişiklikleri odaklı tutun ve pull request göndermeden önce python -m py_compile export_site.py komutunu çalıştırın. Özel veya izinsiz web sitelerini test verisi olarak kullanmayın.

Lisans

Bu proje MIT Lisansı ile lisanslanmıştır.


English

A Python command-line tool that exports the public-facing pages generated by PHP, Laravel, WordPress, or another server-side system as static HTML. Private administration paths can be excluded from the crawl.

Important

Use this tool only on websites you own or are authorized to export.

Features

  • Crawls HTML pages on the same domain.
  • Treats HTTP/HTTPS and www/non-www variants as the same website.
  • Follows HTML meta refresh redirects.
  • Downloads CSS, JavaScript, images, fonts, audio, and video assets.
  • Rewrites HTML links, srcset values, and CSS url(...) references.
  • Excludes administration panels and other private paths.
  • Stores query-string URLs without overwriting files.
  • Supports page limits, request delays, timeouts, and custom User-Agent values.

Requirements

  • Python 3.10 or later
  • A website accessible over the internet or your local network

Installation

git clone https://github.com/mavisland/static-site-exporter.git
cd static-site-exporter
python -m venv .venv

Activate the virtual environment:

source .venv/bin/activate

Install dependencies:

python -m pip install -r requirements.txt

Basic usage

python export_site.py https://example.com

If the protocol is omitted, https:// is used. The domain name is used as the default output directory.

Choose an output directory:

python export_site.py https://example.com --output site-output

Exclude private paths:

python export_site.py https://example.com \
  --exclude /admin \
  --exclude /account \
  --exclude /cart

When no --exclude option is supplied, /admin, /yonetim, /panel, and /login are excluded automatically. Custom exclusions replace the default list. An excluded path also excludes all of its descendants.

Limit crawling and reduce server load:

python export_site.py https://example.com \
  --max-pages 500 \
  --delay 0.25 \
  --timeout 60

Accept an invalid or self-signed TLS certificate in a local environment:

python export_site.py https://localhost --insecure

Display all options:

python export_site.py --help

Preview the export

Serve the generated directory over HTTP instead of opening files directly:

cd site-output
python -m http.server 8000

Then open http://localhost:8000.

What is downloaded?

  • HTML pages on the same domain
  • Linked images, JavaScript, CSS, fonts, video, and audio assets
  • Images referenced by srcset
  • Local assets referenced by CSS url(...)
  • HTML meta refresh redirect targets

Local links are rewritten for the exported directory structure. A short digest is added to filenames generated from query-string URLs to prevent collisions.

Limitations

  • PHP, databases, forms, authentication, search, payments, carts, and other server-side features do not work in a static export.
  • Content generated only after JavaScript execution is not captured. Such sites require a browser-based solution using Playwright or Selenium.
  • Assets hosted on third-party domains or CDNs remain external references.
  • Authenticated crawling is not currently supported.
  • Respect website ownership, terms of use, copyright, and access rules.

Run exports against a local or staging environment when possible.

Professional support

I provide professional support for custom export workflows, authenticated sites, JavaScript-rendered pages, large migrations, and deployment integrations. To discuss your requirements, open a detailed GitHub issue.

Contributing

Contributions are welcome. Open an issue before starting a substantial change, keep changes focused, and run python -m py_compile export_site.py before submitting a pull request. Do not use private or unauthorized websites as test data.

License

This project is licensed under the MIT License.

About

Static Site Exporter

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages