{"id":16377927,"url":"https://github.com/sofianedjerbi/brainfryer","last_synced_at":"2025-11-11T07:06:19.799Z","repository":{"id":227688514,"uuid":"772051194","full_name":"sofianedjerbi/BrainFryer","owner":"sofianedjerbi","description":"Generate attention-grabbing videos!","archived":false,"fork":false,"pushed_at":"2024-03-20T13:56:50.000Z","size":108031,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-01T13:43:46.196Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sofianedjerbi.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}},"created_at":"2024-03-14T12:50:59.000Z","updated_at":"2024-03-14T16:36:42.000Z","dependencies_parsed_at":"2024-04-05T16:30:10.125Z","dependency_job_id":"f8ff8699-37a3-4b76-a60e-d1fea4183ba0","html_url":"https://github.com/sofianedjerbi/BrainFryer","commit_stats":null,"previous_names":["chaoxel/brainfryer","sofianedjerbi/brainfryer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofianedjerbi%2FBrainFryer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofianedjerbi%2FBrainFryer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofianedjerbi%2FBrainFryer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofianedjerbi%2FBrainFryer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sofianedjerbi","download_url":"https://codeload.github.com/sofianedjerbi/BrainFryer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240002100,"owners_count":19732164,"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","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":"2024-10-11T03:44:15.265Z","updated_at":"2025-11-11T07:06:19.757Z","avatar_url":"https://github.com/sofianedjerbi.png","language":"Python","readme":"\u003cimg src=\"./.github/media/logo.png?\" alt=\"BrainFryer logo\" align=\"right\" width=\"25%\"\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003eBrainFryer\u003c/h1\u003e\n  \u003ch3\u003eTurn online discussions into captivating videos!\u003c/h3\u003e\n  \u003ch5\u003e\u003ci\u003eJoin our creative community!\u003c/i\u003e\u003c/h5\u003e\n  \n  [![License](https://img.shields.io/github/license/chaoxel/BrainFryer?style=for-the-badge\u0026logo=github)](LICENSE)\n  [![Discord](https://img.shields.io/discord/1195177036210253864?color=5865F2\u0026label=discord\u0026style=for-the-badge)](https://discord.gg/jwb26Xy5M7)\n  [![Demo](https://img.shields.io/badge/Demo%20-%20Demo?logo=tiktok\u0026label=TikTok\u0026style=for-the-badge)](https://www.tiktok.com/@redditeel)\n\u003c/div\u003e\n\n\n\n## How to use\n### Basic Usage\nYou can use the wizard by typing `python -m brainfryer`.  \nA CLI is available: `python -m brainfryer \u003cReddit URL\u003e`\n\n### CLI Options\n\nBrainfryer supports several options for customization:\n\n- `-h`, `--help`: Display the help message and exit.\n- `-c COMMENTS`, `--comments COMMENTS`: Specify the maximum number of comments to retrieve (default is 10).\n- `-b BACKGROUND`, `--background BACKGROUND`: Provide a YouTube URL for the video background (optional).\n- `-s SONG`, `--song SONG`: Provide a YouTube URL for the background song (optional).\n- `-i`, `--gen-images`: Enable image generation for your video (disabled by default).\n- `-t`, `--gen-subtitles`: Enable subtitle generation for your video (disabled by default).\n- `-d`, `--dall-e`: Use Dall-E for image generation instead of Stable Diffusion (disabled by default).\n- `-u`, `--upload`: Upload the generated video on TikTok using `cookies.txt` (disabled by default).\n\n### Example\n\nTo generate a video with images, subtitles, and upload it to TikTok, using a specific Reddit URL, background, and song, your command might look like this:\n\n```bash\npython -m brainfryer https://www.reddit.com/r/exampleSubreddit/examplePost -c 20 -b https://youtu.be/exampleBackground -s https://youtu.be/exampleSong -i -t -u\n```\n\nThis command uses a Reddit URL, sets the maximum comments to 20, specifies background and song YouTube URLs, enables image and subtitle generation, and uploads the final product to TikTok.\n\n### Demo\n\nA live demo is available [here](https://www.tiktok.com/@redditeel).\n\n## Setup\n\nBrainFryer uses OpenAI's **TTS API** and **ChatGPT** for illustrations.\n\n- Clone the repository: `https://github.com/chaoxel/BrainFryer.git`\n- Enter the directory: `cd BrainFryer`\n- Install dependencies: `pip install -r requirements.txt`\n- Install [playwright](https://playwright.dev/python/docs/intro): `playwright install`\n- Copy `.env.example`: `cp .env.example .env`\n- Configure `.env`: `nano .env`\n\nIf you need subtitles:\n\n- Install [CUDA Toolkit](https://developer.nvidia.com/cuda-downloads)\n- Install [cuDNN](https://developer.nvidia.com/cudnn)\n\nIf you need illustrations:\n\n- With [Dall-E](https://openai.com/dall-e-3): No configuration needed.\n- With [Stable Diffusion](https://github.com/AUTOMATIC1111/stable-diffusion-webui): Install the [webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui) and run it with `--api`. Configure *host* and *port* in `.env`.\n\n## Behind the Scenes\n\nBrainfryer turns Reddit threads into videos through a multi-step process:\n\n1. **Webpage Parsing**: Utilizes Playwright to navigate and parse the target webpage for content extraction.\n2. **Screenshot Capture**: Takes screenshots of the webpage, capturing key visual elements.\n3. **Content Analysis**: Uses ChatGPT to analyze the extracted content and identify themes or key points.\n4. **Illustration Prompt Generation**: Based on the analysis, generates creative prompts for illustrations.\n5. **Image Generation**: Sends these prompts to Stable Diffusion or Dall-E, which then generate corresponding images.\n6. **Text-to-Speech Synthesis**: Converts the extracted textual content into spoken words using OpenAI's TTS API.\n7. **Background Video Processing**:\n   - Downloads the specified YouTube background video using Pytube.\n   - Edits and crops the background video to fit the final video's format using Moviepy.\n8. **Video Assembly**: Combines the generated images, edited background video, and synthesized speech into a cohesive video using Moviepy.\n9. **Audio Transcription**: Converts the final video's audio into text using Whisper for subtitle generation.\n10. **Subtitle Timing**: Analyzes the transcription to add accurate timestamps for each word, creating synchronized subtitles.\n11. **Final Editing**: Applies the subtitles to the video, adjusting for readability and style.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsofianedjerbi%2Fbrainfryer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsofianedjerbi%2Fbrainfryer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsofianedjerbi%2Fbrainfryer/lists"}