8000 GitHub - RajanSandha/auto_blog_script
[go: up one dir, main page]

Skip to content

RajanSandha/auto_blog_script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Automated Blog Publishing System

A fully automated system for generating and publishing daily tech news blog posts using AI and RSS feeds. This system fetches the latest tech news, uses AI to generate blog content, and publishes to GitHub Pages with minimal human interaction using the Minimal Mistakes Jekyll theme.

Features

  • Fetches tech news from multiple RSS feeds
  • Generates high-quality blog posts using AI (supports OpenAI and Google Gemini)
  • Downloads and locally stores images from news articles
  • Creates properly formatted Jekyll posts for Minimal Mistakes theme
  • Publishes to GitHub repository automatically
  • Flexible AI provider system - switch between different AI providers easily
  • Modular design for easy maintenance and extension

Requirements

  • Python 3.8+ (standard method) OR Docker (containerized method)
  • GitHub account
  • API keys for AI providers (OpenAI and/or Google Gemini)
  • GitHub Personal Access Token with repo scope

Quick Start

Standard Method (with Python)

  1. Clone this Repository
git clone https://github.com/yourusername/auto_blog.git
cd auto_blog
  1. Configure Environment Variables Copy the example environment file and fill in your details:
cp auto_blog/.env.example .env

Edit the .env file with your API keys and GitHub credentials.

  1. Run the Setup Script This will create a virtual environment and set up the Minimal Mistakes blog repository:
# On Linux/Mac
./setup.py

# On Windows
python setup.py
  1. Run the System Generate and publish blog posts:
# On Linux/Mac
./run.py

# On Windows
python run.py

Docker Method (cross-platform, including Android)

For the easiest experience, especially on Android or other platforms, use our Docker container:

  1. Get the Code and Configure
git clone https://github.com/yourusername/auto_blog.git
cd auto_blog
cp .env.example .env
# Edit .env with your credentials
  1. Build and Run with Docker
# Build the Docker image
./run-docker.sh build

# Run the system
./run-docker.sh run

That's it! The Docker container includes all dependencies and handles everything automatically.

  1. For Android Users
# Install and setup Docker on Termux
./android-docker.sh setup

# Build and run
./android-docker.sh build
./android-docker.sh run

See DOCKER_USAGE.md for detailed Docker instructions.

5. Enable GitHub Pages

  1. Go to your GitHub repository
  2. Navigate to Settings → Pages
  3. Under "Source", select "Deploy from a branch"
  4. Select your branch (main) and the root folder (/)
  5. Click Save

Your blog will be available at: https://yourusername.github.io/yourrepository/

Detailed Setup

Setting Up GitHub

  1. Create a GitHub Repository

    • Go to GitHub and create a new repository with the name you specified in .env
    • You don't need to initialize it with any files
  2. Create a Personal Access Token

    • Go to GitHub Settings → Developer Settings → Personal access tokens → Tokens (classic)
    • Click "Generate new token", give it a descriptive name
    • Select the "repo" scope (gives full control of private repositories)
    • Copy the token and add it to your .env file as GITHUB_TOKEN

AI Providers

You can choose between OpenAI (GPT models) and Google Gemini for content generation:

  1. Using OpenAI

    • Sign up for an API key at OpenAI
    • Set AI_PROVIDER=openai in your .env file
    • Add your API key as OPENAI_API_KEY in the .env file
  2. Using Google Gemini

    • Sign up for an API key at Google AI Studio
    • Set AI_PROVIDER=gemini in your .env file
    • Add your API key as GEMINI_API_KEY in the .env file

RSS Feeds

The system comes with default tech news feeds, but you can customize them:

RSS_FEEDS=https://techcrunch.com/feed/,https://www.theverge.com/rss/index.xml,https://www.wired.com/feed,https://arstechnica.com/feed/

Add or remove feeds as needed, separating them with commas.

Customizing Your Blog

Theme Customization

You can customize the Minimal Mistakes theme by editing these files:

  1. _config.yml: Main configuration file in the github_repo directory

    • Set site name, description, author information
    • Change color scheme with minimal_mistakes_skin
    • Configure navigation, analytics, comments
  2. Navigation: Create or edit github_repo/_data/navigation.yml

    main:
      - title: "Posts"
        url: /posts/
      - title: "Categories"
        url: /categories/
      - title: "Tags"
        url: /tags/
      - title: "About"
        url: /about/
  3. Profile Picture: Add your photo to github_repo/assets/images/ and update _config.yml

For more detailed customization, refer to the Minimal Mistakes documentation.

Automatic Deployment

Running Daily Updates

To automatically generate posts daily, you can set up a cron job (Linux/Mac) or Task Scheduler (Windows).

Linux/Mac (cron)

# Open crontab
crontab -e

# Add this line to run daily at 8 AM
0 8 * * * cd /path/to/auto_blog && ./run.py >> logs/cron.log 2>&1

Windows (Task Scheduler)

  1. Open Task Scheduler
  2. Create a new Basic Task
  3. Set trigger to Daily
  4. Action: Start a Program
  5. Program/script: C:\path\to\python.exe
  6. Arguments: C:\path\to\auto_blog\run.py

Docker Method (all platforms)

# Add to crontab
0 8 * * * cd /path/to/auto_blog && ./run-docker.sh run >> logs/cron.log 2>&1

Troubleshooting

Common Issues

  • Authentication Errors: Ensure your GitHub token has the correct permissions and is correctly set in the .env file

  • Dependency Issues: If you encounter errors with dependencies, try running:

    pip install -r requirements.txt
  • GitHub Pages Not Building: Check if your repository has GitHub Pages enabled in Settings → Pages

  • Missing Images: If images aren't displaying, check that they're being correctly saved to github_repo/assets/images/

  • RSS Feed Issues: If specific feeds like Wired.com are causing problems, they will be automatically skipped after multiple timeout attempts

Project Structure

auto_blog/
├── __init__.py
├── main.py                  # Main entry point
├── config.py                # Configuration handling
├── rss_fetcher/             # RSS feed handling
├── ai_content/              # AI integration for different providers
├── image_handler/           # Image downloading and processing
├── post_generator/          # Jekyll post generation
├── github_manager/          # GitHub repository management
└── utils/                   # Utility functions

License

[Your License Here]

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0