TailwindUI-Scraper Tailwind Templates

Tailwindui Scraper

A powerful and efficient scraping tool designed to extract component information and code samples from Tailwind UI's component library.

🎨 Tailwind UI Component Scraper

A Python-based web scraper designed to automatically extract and organize components from Tailwind UI. This tool preserves the original site structure and saves React components in a hierarchical folder system.

✨ Features

  • πŸ”‘ Automatic login to Tailwind UI
  • πŸ—οΈ Maintains original site structure (Marketing, Application UI, Ecommerce)
  • πŸ“₯ Extracts React component code
  • πŸ“ Creates organized folder hierarchy
  • πŸ’Ύ Saves component code in JSX files
  • πŸ“ Generates a structured index of all components

πŸ“‚ Folder Structure

The scraper creates a hierarchical folder structure:

components/
β”œβ”€β”€ Marketing/
β”‚   β”œβ”€β”€ Page Sections/
β”‚   β”‚   β”œβ”€β”€ Hero Sections/
β”‚   β”‚   β”‚   β”œβ”€β”€ SimpleHero.jsx
β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   └── ...
β”‚   └── ...
β”œβ”€β”€ Application UI/
└── Ecommerce/

πŸ“‹ Prerequisites

  • 🐍 Python 3.8 or higher
  • 🌐 Chrome browser
  • πŸš— ChromeDriver
  • πŸ” Tailwind UI account

πŸš€ Installation

  1. Clone the repository:
git clone <your-repository-url>
cd tailwind-ui-scraper
  1. Create and activate a virtual environment (recommended):
python -m venv venv
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activate
  1. Install required packages:
pip install -r requirements.txt
  1. Set up environment variables: Create a .env file in the project root:
[email protected]
TAILWIND_UI_PASSWORD=your-password

πŸ› οΈ Usage

  1. Run the main script:
python components.py

The script will:

  1. πŸ”‘ Log in to Tailwind UI
  2. πŸ“„ Generate a structured index in tailwind_components_structure.txt
  3. πŸ” Visit each component page
  4. πŸ“₯ Extract React component code
  5. πŸ’Ύ Save components in their respective folders

πŸ”§ Script Structure

  • πŸ—ΊοΈ get_component_structure(): Creates initial site structure map
  • πŸ“ save_structure_to_file(): Saves structure to text file
  • 🌐 visit_component_urls(): Visits each component URL
  • πŸ“€ get_component_code(): Extracts component code
  • πŸ” login(): Handles Tailwind UI authentication

⚠️ Error Handling

The script includes error handling for:

  • 🌐 Network timeouts
  • πŸ” Missing elements
  • πŸ”’ Authentication issues
  • πŸ“ File system operations

πŸ“ Notes

  • βœ… The script respects Tailwind UI's structure
  • πŸ”„ Components are saved with sanitized filenames
  • πŸ“„ Each component gets its own JSX file
  • πŸ“Š Progress is logged to console

βš–οΈ Disclaimer

This tool is for educational purposes. Ensure you have proper authorization and comply with Tailwind UI's terms of service when using this scraper.

Top categories

Loading Svelte Themes