Skip to content

Latest commit

Β 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌐 WebClone v2.1.0

Clone any website in seconds. Perfect for learning, prototyping, and building.

PyPI version License: MIT Python 3.8+

WebClone is a command-line tool that creates local, mostly offline copies of web pages: it saves HTML, CSS, JavaScript, images, fonts, and related assets, then rewrites paths so you can open the result from disk or a small static server.

Perfect for: Learning web development, studying designs, creating prototypes, and building templates.

How it works (under the hood)

  1. Playwright (Chromium) loads your URL so JavaScript-rendered content is included in the HTML snapshot.
  2. Light + dark capture β€” two browser passes merge network activity so prefers-color-scheme: dark stylesheets and assets load, and the saved HTML comes from the dark pass (with common dark / data-theme hooks on <html>).
  3. HTML parsing pulls link, script, img, srcset, lazy data-src, icons, inline <style> url(...), etc.
  4. Recursive crawling β€” follows every internal <a href> to discover and download ALL site pages (homepage, sub-pages, blog posts, etc.), not just the entry URL.
  5. Module chunk discovery β€” finds all <link rel="modulepreload"> and <script type="module"> entries to download dynamically-loaded JS chunks.
  6. Build path preservation β€” _nuxt/, _next/, cms/, css/, fonts/ paths stay exactly as the server served them so framework dynamic imports keep working offline.
  7. Extra downloads from responses the browser actually made (fonts, chunks, images that never appear as plain tags).
  8. CSS follow-up walks downloaded stylesheets for url(...) and @import, downloads nested assets, and rewrites paths.
  9. A final pass replaces known remote URLs in HTML and *.css with local paths where possible.
  10. Falls back to a plain HTTP fetch if Playwright is unavailable or errors.

⚠️ For educational use only. Respect copyright laws. See Legal Disclaimer.


πŸ“¦ Installation

pip install webclone-cli
playwright install chromium

πŸš€ Quick Start

# Clone any website
webclone https://example.com

# Clone with custom name
webclone https://stripe.com stripe_clone

# View the result
cd example_com_cloned
python -m http.server 8000
# Visit http://localhost:8000

✨ Features

  • πŸš€ One command β€” webclone <url> [folder]
  • πŸ•·οΈ Recursive crawling β€” Follows internal links and downloads ALL pages (like wget --mirror)
  • 🎭 Headless browser render β€” Snapshots the DOM after JS runs (Playwright Chromium)
  • πŸ“‘ Fetch/XHR recording β€” Captures runtime API calls as JSON files for offline use
  • 🧩 Framework route interception β€” Detects Nuxt _payload, Next _next/data, Astro islands, SW manifests
  • πŸ“¦ Service Worker capture β€” Saves sw.js, workbox bundles, webmanifest
  • πŸ’Ύ Browser storage export β€” Exports localStorage, sessionStorage, cookies
  • πŸ”„ DOM mutation observer β€” Waits for SPA content to stabilize before snapshot
  • πŸ“œ Infinite scroll detection β€” Scrolls until height stops growing (blogs, feeds, docs)
  • πŸ–ΌοΈ Iframe capture β€” Clones same-origin iframes inline
  • πŸ“Š HAR export β€” Saves network.har for debugging failed clones
  • πŸŒ™ Dark theme aware β€” Light + dark passes for complete asset capture
  • πŸ“¦ CSS deep crawl β€” Follows url(...) and @import inside stylesheets
  • πŸ”§ Build path preservation β€” Keeps _nuxt/, _next/, cms/ paths intact
  • 🧩 Module chunk discovery β€” Finds modulepreload and lazy-loaded JS
  • πŸ”§ Local path rewriting β€” Points HTML/CSS at downloaded files
  • πŸ“ Per-clone README β€” Auto-generated docs with asset counts
  • 🎯 Great for learning β€” Inspect real layouts, typography, and structure offline

πŸ’‘ What Works Best

βœ… Great Results With:

  • Static Sites - Landing pages, portfolios (Docker.com, Stripe.com)
  • Client-Side Apps - React, Vue, Next.js apps (Vercel.com, Linear.app)
  • Documentation - Docs sites, wikis, guides
  • Marketing Pages - Product pages, company sites

⚠️ Limited Support:

  • CMS Sites - WordPress, Umbraco (clones design, not backend)
  • Server-Side Apps - PHP, ASP.NET (visual shell only)
  • API-Heavy Apps - Dynamic dashboards (layout only)

Still useful for: Studying designs, extracting UI components, learning CSS structures.

Learn more about what can/cannot be cloned β†’


πŸ“– Usage Examples

Learning from top companies:

webclone https://www.stripe.com
webclone https://www.linear.app
webclone https://vercel.com

Building prototypes:

webclone https://landing-template.com my_project
# Edit the HTML/CSS to customize

Studying documentation:

webclone https://docs.docker.com docker_docs

πŸ”§ Troubleshooting

Website shows raw HTML?

Problem: JavaScript won't run when opened directly (file://)

Solution: Use a local server:

cd your_cloned_site
python3 -m http.server 8000
# Visit http://localhost:8000

Missing images or styles?

  • External CDN resources may fail to download (CORS, auth, signed URLs)
  • Some assets load only after user interaction or infinite scroll β€” clone again after scrolling the live site, or accept gaps
  • Analytics / POST-only URLs in the network list may β€œfail” on GET β€” harmless
  • Check browser DevTools (F12) β†’ Console when viewing the clone

Cloudflare or bot protection?

Sites behind Cloudflare / aggressive bot checks may block headless Chromium or return challenge pages. There is no guaranteed bypass. Options: use content you’re allowed to archive (API, export, staging), or complete a challenge in a normal browser and explore cookie / session workflows yourself if appropriate.

Looks different from original?

  • Server-side rendered content won't clone
  • Database/CMS content needs backend
  • Works best with client-side rendered sites

πŸ“‚ Output Structure

your_cloned_site/
β”œβ”€β”€ index.html              # Main HTML file
β”œβ”€β”€ page1.html              # Crawled pages
β”œβ”€β”€ page2/
β”‚   └── index.html          # Nested pages
β”œβ”€β”€ README.md               # Auto-generated docs
β”œβ”€β”€ _nuxt/                  # Framework build files (preserved as-is)
β”œβ”€β”€ _next/                  # Next.js build files (preserved as-is)
β”œβ”€β”€ cms/                    # CMS assets (preserved as-is)
└── assets/
    β”œβ”€β”€ css/               # Stylesheets
    β”œβ”€β”€ js/                # JavaScript files
    β”œβ”€β”€ images/            # Images
    β”œβ”€β”€ fonts/             # Web fonts
    └── files/             # Other assets

πŸ› οΈ Requirements

  • Python 3.8+
  • Internet connection
  • Chromium for Playwright (one-time after install): playwright install chromium
  • Dependencies (auto-installed):
    • requests
    • beautifulsoup4
    • lxml
    • playwright (renders the page so JS-heavy sites clone better; assets still downloaded by WebClone)

πŸ“‹ Command Options

webclone <url> [output_directory]

Arguments:
  url                  Website URL to clone
  output_directory     Optional custom folder name (default: <host>_cloned)

There are no subcommands or flags β€” one URL, one optional output folder.


🀝 Contributing

Contributions welcome!

git clone https://github.com/AbdirahmanNomad/webclone.git
cd webclone
pip install -r requirements.txt
playwright install chromium
pip install -e ".[dev]"

πŸ“ License

MIT License - see LICENSE file for details.


⚠️ Important Notice

For educational purposes only.

  • βœ… Learning and personal projects
  • βœ… Design inspiration and research
  • ❌ Commercial use without permission
  • ❌ Copyright infringement

Users are responsible for respecting copyright laws. See full Legal Disclaimer.


πŸ‘€ Author

Abdirahman Ahmed


πŸ“ˆ Support

Give a ⭐️ if this project helped you!


Made with ❀️ for developers learning web development

About

Clone any website in seconds. Perfect for learning web development, prototyping, and building. Published on PyPI

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages