{"id":30304801,"url":"https://github.com/ynstf/y2p-core","last_synced_at":"2025-08-17T07:33:39.591Z","repository":{"id":300309622,"uuid":"1005808761","full_name":"ynstf/Y2P-core","owner":"ynstf","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-25T01:15:40.000Z","size":84,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-25T06:47:58.297Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://y2p-api.vercel.app","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ynstf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-20T21:27:59.000Z","updated_at":"2025-07-25T01:15:44.000Z","dependencies_parsed_at":"2025-06-21T01:19:43.906Z","dependency_job_id":"3e8fb396-a6dd-41bd-ba19-e024c05fdca7","html_url":"https://github.com/ynstf/Y2P-core","commit_stats":null,"previous_names":["ynstf/y2p-coer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ynstf/Y2P-core","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ynstf%2FY2P-core","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ynstf%2FY2P-core/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ynstf%2FY2P-core/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ynstf%2FY2P-core/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ynstf","download_url":"https://codeload.github.com/ynstf/Y2P-core/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ynstf%2FY2P-core/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270820676,"owners_count":24651515,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-17T07:33:38.903Z","updated_at":"2025-08-17T07:33:39.579Z","avatar_url":"https://github.com/ynstf.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YouTube Tutorial to Project Scaffold\n\nAn automated tool that watches programming tutorial videos and generates complete, runnable project scaffolds from them. Simply provide a YouTube URL, and the system will extract the transcript, analyze the code structure, and create a fully organized project directory with all files and folders.\n\n## Features\n\n- **Automatic Transcript Extraction**: Downloads video transcripts from YouTube tutorials\n- **AI-Powered Code Analysis**: Uses Google Gemini AI to parse transcripts and identify project structure\n- **Complete Project Generation**: Creates folders, files, and organizes code exactly as shown in tutorials\n- **Ready-to-Run Output**: Generates a zipped project folder ready for immediate use\n- **Smart Error Handling**: Handles common parsing issues and file format corrections\n- **FastAPI Web Interface**: Modern REST API for easy integration and web-based usage\n- **Asynchronous Processing**: Background task processing with real-time status tracking\n- **File Downloads**: Direct download links for completed projects\n\n## Prerequisites\n\n- Python 3.7+\n- Google Gemini API key\n- Internet connection for transcript fetching\n\n## Installation\n\n1. **Clone the repository**\n   ```bash\n   git clone https://github.com/ynstf/Y2P-core\n   cd Y2P-core\n   ```\n\n2. **Install dependencies**\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n3. **Set up environment variables**\n   ```bash\n   cp .env-template .env\n   ```\n   Edit `.env` and add your Google Gemini API key:\n   ```\n   GEMINI_API_KEY = \"your-actual-api-key-here\"\n   ```\n\n4. **Create output directory**\n   ```bash\n   mkdir output\n   ```\n\n## Usage\n\n### Option 1: FastAPI Web Server (Recommended)\n\nStart the FastAPI server:\n\n```bash\npython app.py\n```\n\nThe server will start on `http://localhost:8000`. You can:\n\n- **View API documentation**: Visit `http://localhost:8000/docs` for interactive Swagger docs\n- **Use the REST API**: Submit videos and track progress programmatically\n- **Access the root endpoint**: `http://localhost:8000/` for API information\n\n#### API Endpoints\n\n- `POST /process` - Submit a YouTube video for processing\n- `GET /status/{task_id}` - Check processing status\n- `GET /download/{task_id}` - Download completed project\n- `GET /tasks` - List all tasks (admin/debug)\n- `DELETE /tasks/{task_id}` - Delete task and cleanup files\n\n#### Example API Usage\n\n```python\nimport requests\n\n# Submit video for processing\nresponse = requests.post(\"http://localhost:8000/process\", \n                        json={\"url\": \"https://youtube.com/watch?v=VIDEO_ID\"})\ntask_data = response.json()\ntask_id = task_data[\"task_id\"]\n\n# Check status\nstatus_response = requests.get(f\"http://localhost:8000/status/{task_id}\")\nstatus = status_response.json()\n\n# Download when completed\nif status[\"status\"] == \"completed\":\n    download_response = requests.get(f\"http://localhost:8000/download/{task_id}\")\n    with open(\"project.zip\", \"wb\") as f:\n        f.write(download_response.content)\n```\n\n#### Using the Test Client\n\nA complete example client is provided in `test.py`:\n\n```bash\npython test.py\n```\n\nThis will guide you through the entire process: submitting a video, monitoring progress, and downloading the result.\n\n### Option 2: Command Line Interface\n\nRun the main script and provide a YouTube tutorial URL when prompted:\n\n```bash\npython main.py\n```\n\nThe system will:\n1. Extract the video transcript\n2. Generate a project manifest using AI\n3. Create the complete project structure\n4. Package everything in a zip file\n\n### Example Workflow\n\n**Command Line:**\n```bash\n$ python main.py\nput video URL : https://www.youtube.com/watch?v=nF_crEtmpBo\ntranscription ok: [transcript content]\nmanifest ok: {'folders': [...], 'files': {...}}\nProject scaffolded and zipped as output\\final_project.zip\n```\n\n**API Workflow:**\n```bash\n$ python test.py\nEnter YouTube URL: https://www.youtube.com/watch?v=nF_crEtmpBo\n✅ Video submitted successfully!\n📋 Task ID: abc123-def456-ghi789\n📊 Status: PROCESSING\n💬 Message: Downloading transcript...\n⏳ Still working... (waiting 5 seconds)\n📊 Status: COMPLETED\n✅ Processing completed!\n📥 Downloading project...\n✅ Project downloaded as project_abc123-def456-ghi789.zip\n🎉 Success! Your project is ready.\n```\n\n### Advanced Usage\n\nYou can also use individual components programmatically:\n\n```python\nfrom services.download_transcript import get_youtube_transcript\nfrom services.generate_manifest import generate_manifest_from_transcript\nfrom services.scaffold_project import scaffold\n\n# Get transcript\ntranscript = get_youtube_transcript(\"https://youtube.com/watch?v=VIDEO_ID\")\n\n# Generate manifest\nmanifest = generate_manifest_from_transcript()\n\n# Create project\nscaffold(manifest, task_id=\"custom_id\")\n```\n\n## Project Structure\n\n```\nyoutube-tutorial-scaffold/\n├── app.py                      # FastAPI web server\n├── main.py                     # Command line entry point\n├── test.py                     # Example API client\n├── services/                   # Core processing modules\n│   ├── __init__.py\n│   ├── download_transcript.py  # YouTube transcript extraction\n│   ├── generate_manifest.py    # AI-powered manifest generation\n│   └── scaffold_project.py     # Project file/folder creation\n├── requirements.txt            # Python dependencies\n├── .env-template              # Environment variables template\n├── urls.txt                   # Sample URLs for testing\n└── output/                    # Generated files directory\n    ├── transcript.txt         # Raw video transcript\n    ├── manifest.json          # Structured project manifest\n    ├── {task_id}_project/     # Generated project files\n    └── {task_id}_project.zip  # Zipped project\n```\n\n## Configuration\n\n### Environment Variables\n\n- `GEMINI_API_KEY`: Your Google Gemini API key (required)\n\n### FastAPI Configuration\n\nThe FastAPI server runs on:\n- **Host**: `0.0.0.0` (accessible from all interfaces)\n- **Port**: `8000`\n- **CORS**: Enabled for all origins (configure for production)\n\n### Customization\n\nYou can modify the AI prompt in `services/generate_manifest.py` to:\n- Change the output format\n- Add specific file type handling\n- Adjust parsing accuracy\n- Include additional metadata\n\n## Output Format\n\nThe system generates a JSON manifest with this structure:\n\n```json\n{\n  \"folders\": [\n    \"relative/path/to/folder\",\n    \"another/folder\"\n  ],\n  \"files\": {\n    \"main.py\": \"# Complete file contents here\",\n    \"config.json\": \"{ \\\"setting\\\": \\\"value\\\" }\",\n    \"subfolder/utils.py\": \"# More code here\"\n  }\n}\n```\n\n## Supported Video Types\n\nWorks best with:\n- **Coding tutorials** with clear step-by-step file creation\n- **Project walkthroughs** showing complete implementations\n- **Course content** with structured programming lessons\n\nMay struggle with:\n- Videos without clear code structure\n- Live coding sessions with lots of backtracking\n- Tutorials mixing multiple unrelated projects\n\n## API Response Formats\n\n### Task Status Response\n```json\n{\n  \"task_id\": \"abc123-def456-ghi789\",\n  \"status\": \"completed\",\n  \"message\": \"Project scaffold created successfully\",\n  \"created_at\": \"2024-01-15T10:30:00\",\n  \"completed_at\": \"2024-01-15T10:32:30\",\n  \"download_url\": \"/download/abc123-def456-ghi789\",\n  \"error\": null\n}\n```\n\n### Status Values\n- `pending` - Task queued for processing\n- `processing` - Currently being processed\n- `completed` - Successfully completed\n- `failed` - Processing failed\n\n## Troubleshooting\n\n### Common Issues\n\n**\"Request failed with status\"**\n- Check your internet connection\n- Verify the YouTube URL is accessible\n- Some videos may have transcript restrictions\n\n**\"Failed to parse JSON\"**\n- The AI might have generated malformed output\n- Check the raw response in the error message\n- Try with a different tutorial video\n\n**\"No such file or directory\"**\n- Ensure the `output` directory exists\n- Check file permissions\n- Verify the transcript was downloaded successfully\n\n**\"Task not found\" (API)**\n- Check if the task_id is correct\n- Tasks are stored in memory and cleared on server restart\n- Use `GET /tasks` to list all available tasks\n\n### Debug Mode\n\nFor the FastAPI server, check the console output for detailed processing steps. For the CLI version, enable verbose output by modifying the print statements in each module.\n\n### Development\n\nTo run the FastAPI server in development mode with auto-reload:\n\n```bash\nuvicorn app:app --reload --host 0.0.0.0 --port 8000\n```\n\n## Production Deployment\n\nFor production deployment:\n\n1. **Use a production ASGI server** like Gunicorn with Uvicorn workers\n2. **Configure CORS** to restrict origins to your frontend domain\n3. **Use a persistent task store** (Redis, database) instead of in-memory storage\n4. **Add authentication** and rate limiting\n5. **Set up reverse proxy** (Nginx) for static files and load balancing\n6. **Configure environment variables** securely\n\nExample production command:\n```bash\ngunicorn app:app -w 4 -k uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000\n```\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## Disclaimer\n\nThis tool is for educational purposes. Always respect:\n- YouTube's Terms of Service\n- Video creators' intellectual property rights\n- API rate limits and usage policies\n\n## Acknowledgments\n\n- NoteGPT API for transcript extraction\n- Google Gemini for AI-powered code analysis\n- FastAPI for the modern web framework\n- The programming tutorial community for creating amazing content\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fynstf%2Fy2p-core","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fynstf%2Fy2p-core","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fynstf%2Fy2p-core/lists"}