Skip to content

[Python, Typescript] Instagram Automation Post Feed and Story, Integrate Data from Facebook Group and Page

License

Notifications You must be signed in to change notification settings

dhohirpradana/Instagram-Automation

Repository files navigation

Instagram Automation Feed and Story

Ikuti saya di LinkedIn: https://linkedin.com/comm/mynetwork/discovery-see-all?usecase=PEOPLE_FOLLOWS&followMember=dhohirpradana

Automate post Instagram feed and Instagram story.

Steps

  1. Instagram account
key name description
IG_USERNAME Instagram username
IG_PASSWORD Instagram password
QUOTES_API_KEY API-Ninjas API key, you can get it from https://api-ninjas.com/api/quotes
  1. Use this template or Clone this repository and push to your Github https://github.com/dhohirpradana/Instagram-Automation.git

  2. Set Github Secrets Go to your repository -> Settings -> Secrets -> Action -> Set Your IG_USERNAME, IG_PASSWORD

  3. (if .github/workflows/main.yml not exists) Create Workflow Go to your repository -> Actions -> New workflow -> Setup a workflow yourself -> whatever.yaml Set when to run the script

name: Instagram Automation

# Controls when the workflow will run
on:
  # Triggers the workflow on push events but only for the master branch
  # push:
  #   branches: [ master ]
  
  # Triggers the workflow with scheduler
  schedule:
    - cron: '0 17 * * *'
    # - cron: '0 11 * * *'
    - cron: '0 05 * * *'

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest
    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      - uses: actions/checkout@v3
      # Python
      - name: Install Python
        uses: actions/setup-python@v4
        with:
          python-version: '3.10'

      - name: Install facebook-scrapper
        run: pip install git+https://github.com/kevinzg/facebook-scraper.git
        shell: bash

      - name: Run Python script
        env:
          COOKIES: '${{ secrets.COOKIES }}'
        id: get-posts
        run: |
          rm results.txt
          git config user.name [github_username]
          git config user.email [github_email]
          git fetch origin
          git reset --hard origin/master
          git pull
          python app.py
          git add results.txt
          git commit -m "results.txt changes"
          git push
        shell: bash

      # NodeJS
      - name: Use Node.js
        uses: actions/setup-node@v3
        with:
          node-version: '16.x'

      - name: Install ts-node
        run: npm install -g ts-node
          
      - name: Install dependencies
        run: npm install
        
      - name: Run node script
        env:
          IG_USERNAME: '${{ secrets.IG_USERNAME }}'
          IG_PASSWORD: '${{ secrets.IG_PASSWORD }}'
          # UNSPLASH_ACCESS_KEY: '${{ secrets.UNSPLASH_ACCESS_KEY }}'
          QUOTES_API_KEY: '${{ secrets.QUOTES_API_KEY }}'
        run: ts-node app.ts
  1. Save

Good Luck

alt text alt text

Instagram Automation CodeFactor