Metadata-Version: 2.4
Name: ph-shorts
Version: 1.0.7
Summary: Download PornHub Shorts videos - Simple & light
Author: PH Shorts Team
License: MIT
Project-URL: Homepage, https://github.com/diastom/PornHub-Shorts
Project-URL: Bug Tracker, https://github.com/diastom/PornHub-Shorts/issues
Project-URL: Documentation, https://github.com/diastom/PornHub-Shorts#readme
Keywords: pornhub,downloader,video,shorts,hls,m3u8,cli
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: End Users/Desktop
Classifier: Topic :: Multimedia :: Video
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Classifier: Environment :: Console
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.31.0
Requires-Dist: rich>=13.0.0
Requires-Dist: click>=8.1.0
Requires-Dist: beautifulsoup4>=4.12.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Dynamic: license-file

# 🎬 PH Shorts Downloader

<div align="center">

![Version](https://img.shields.io/badge/version-1.0.6-blue.svg)
![Python](https://img.shields.io/badge/python-3.10+-brightgreen.svg)
![License](https://img.shields.io/badge/license-MIT-green.svg)

**Download PornHub Shorts videos with style!** ✨

*A lightweight, specialized downloader with a beautiful CLI*

[Installation](#-installation) • [Usage](#-usage) • [Examples](#-examples)

</div>

---

## ✨ Features

- 🎯 **Specialized** - Built specifically for PornHub Shorts
- 📚 **Programmable API** - Use as a Python library to build custom scripts and bots
- 🎨 **Beautiful CLI** - Rich terminal UI with colors and progress bars
- 🚀 **Fast Downloads** - Multi-threaded segment downloading
- 📺 **Quality Selection** - Choose from available qualities (1080p, 720p, 480p, etc.)
- 🌐 **Proxy Support** - Built-in HTTP/HTTPS proxy support
- ⚡ **Async Support** - Perfect for Telegram/Discord bot integration
- 🔄 **Auto-conversion** - Automatic conversion to MP4 (requires FFmpeg)
- 💾 **Smart Naming** - Automatically extracts and sanitizes video titles
- 🔁 **Retry Logic** - Auto-retry failed segments
- 🖥️ **Cross-platform** - Works on Windows, Linux, and macOS

## 📦 Installation

### Method 1: From PyPI ✅ (Recommended)

```bash
pip install ph-shorts
```

### Method 2: Quick Install (Linux/macOS)

```bash
chmod +x install.sh
./install.sh
```

### Method 3: Quick Install (Windows)

```batch
install.bat
```

### Method 4: Manual Install with pip

```bash
# Clone or download the repository
git clone https://github.com/diastom/PornHub-Shorts.git
cd PornHub-Shorts

# Install using pip
pip install .

# Or install in development mode
pip install -e .
```

## 🚀 Usage

### Interactive Mode (Recommended for beginners)

Simply run without arguments:

```bash
ph-shorts
```

You'll get a beautiful interactive menu:

```
╔════════════════════════════════════════════════════════════════════════════╗
║  ██████╗ ██╗  ██╗    ███████╗██╗  ██╗ ██████╗ ██████╗ ████████╗███████╗  ║
║  ██╔══██╗██║  ██║    ██╔════╝██║  ██║██╔═══██╗██╔══██╗╚══██╔══╝██╔════╝  ║
║  ██████╔╝███████║    ███████╗███████║██║   ██║██████╔╝   ██║   ███████╗  ║
║  ██╔═══╝ ██╔══██║    ╚════██║██╔══██║██║   ██║██╔══██╗   ██║   ╚════██║  ║
║  ██║     ██║  ██║    ███████║██║  ██║╚██████╔╝██║  ██║   ██║   ███████║  ║
║  ╚═╝     ╚═╝  ╚═╝    ╚══════╝╚═╝  ╚═╝ ╚═════╝ ╚═╝  ╚═╝   ╚═╝   ╚══════╝  ║
╚════════════════════════════════════════════════════════════════════════════╝
            Download PornHub Shorts with Style!
    version 1.0.6 • Lightweight & Beautiful CLI
```

### Command Line Mode (For power users)

```bash
ph-shorts "VIDEO_URL" [OPTIONS]
```

## 📝 Examples

### Basic download (best quality)
```bash
ph-shorts "https://www.pornhub.com/view_video.php?viewkey=..."
```

### Specify quality
```bash
ph-shorts "URL" -q 720
```

### Custom output filename
```bash
ph-shorts "URL" -o my_video.mp4
```

### Use a proxy
```bash
ph-shorts "URL" -p http://127.0.0.1:1080
```

### Keep original .ts file
```bash
ph-shorts "URL" --keep-ts
```
```

### Async Support (for Bots)

Perfect for Telegram bots, Discord bots, and other async applications:

```python
from PHShorts import AsyncVideoDownloader

async def download_for_bot(url: str):
    async with AsyncVideoDownloader() as downloader:
        # Get info first
        info = await downloader.get_info(url)
        print(f"Downloading: {info['title']}")
        
        # Download video
        video_path = await downloader.download(url)
        return video_path
```

### More Examples

Check the [`examples/`](examples/) directory for complete working examples:
- [`basic_usage.py`](examples/basic_usage.py) - Simple download
- [`progress_tracking.py`](examples/progress_tracking.py) - Progress bar
- [`telegram_bot.py`](examples/telegram_bot.py) - Telegram bot integration
- [`batch_download.py`](examples/batch_download.py) - Batch downloads

## ⚙️ Options

```
Usage: ph-shorts [URL] [OPTIONS]

Arguments:
  URL                   Video URL (optional - will prompt if not provided)

Options:
  -o, --output TEXT     Custom output filename
  -q, --quality TEXT    Quality: best, worst, 1080, 720, 480 (default: best)
  -p, --proxy TEXT      HTTP/HTTPS proxy URL
  --keep-ts             Keep original .ts file (don't convert to mp4)
  --help                Show this message and exit
```

### Quality Options

- `best` - Highest available quality (default)
- `worst` - Lowest available quality (saves bandwidth)
- `1080` - 1080p (if available)
- `720` - 720p (if available)
- `480` - 480p (if available)

## 🔧 Requirements

### Required
- Python 3.10 or higher
- Internet connection

### Optional (Recommended)
- **FFmpeg** - For automatic MP4 conversion
  - Without FFmpeg, videos are saved as `.ts` files
  - Install:
    - **Ubuntu/Debian**: `sudo apt install ffmpeg`
    - **macOS**: `brew install ffmpeg`
    - **Windows**: Download from [ffmpeg.org](https://ffmpeg.org/download.html)

## 🐛 Troubleshooting

### Issue: "403 Forbidden" error
**Solution**: The site might be blocking requests. Try using a different User-Agent or proxy.

### Issue: Videos saved as .ts instead of .mp4
**Solution**: Install FFmpeg for automatic conversion.

### Issue: Slow download speed
**Solution**: 
- Check your internet connection
- Try using a proxy closer to the server location
- The quality you selected might be from a slower CDN

### Issue: "No compatible HLS stream found"
**Solution**: The video URL might be invalid or the video format is not supported.

## 🤝 Contributing

Contributions are welcome! Feel free to:
- Report bugs
- Suggest new features
- Submit pull requests

## 📜 License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## ⚖️ Disclaimer

This tool is for educational purposes only. Please respect copyright laws and the terms of service of the websites you download from. The developers are not responsible for any misuse of this software.

## 🙏 Credits

Built with:
- [Rich](https://github.com/Textualize/rich) - Beautiful terminal formatting
- [Click](https://github.com/pallets/click) - CLI framework
- [Requests](https://github.com/psf/requests) - HTTP library

## 📧 Support

If you encounter any issues or have questions:
- Open an issue on GitHub
- Check existing issues for solutions

---

<div align="center">

**Made with ❤️ for the community**

If this tool helped you, consider giving it a ⭐ on GitHub!

</div>
