Skip to content

About

A Chrome extension that generates LinkedIn comments from post content built with JavaScript, Manifest V3 and the Gemini API.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

LinkedIn Auto Commenter (AutoCommentor)

A Chrome extension that automates commenting on LinkedIn. It reads a post's text and uses Google's Gemini API to generate a relevant professional comment then posts it into LinkedIn's comment box automatically.

Built as a Final Year Project to demonstrate browser extension development DOM automation and integration with a generative AI API.

What It Does

  1. You open a LinkedIn post and click the extension icon.
  2. The extension reads the text of the post from the page.
  3. That text is sent to Gemini which generates a short professional comment.
  4. The extension types the comment into LinkedIn's comment box and clicks Comment for you.

Tech Stack

  • Chrome Extension Manifest V3 for the extension framework
  • JavaScript for core logic
  • HTML and CSS for the popup UI
  • Google Gemini API for generating comments
  • Chrome Extension APIs scripting tabs storage and runtime messaging

Project Structure

manifest.json      Extension configuration and permissions
popup.html         The popup UI shown when clicking the icon
popup.js           Calls Gemini and inserts/posts the comment
background.js      Bridges popup and LinkedIn page to extract post text
contentscript.js   Injected into LinkedIn pages to read post text

How It Works

manifest.json sets up the popup the background service worker and a content script that runs on LinkedIn pages along with the permissions needed to read and act on the active tab.

contentscript.js runs automatically on LinkedIn. It finds the post's text block in the page grabs the text inside it and sends that text to the background script.

background.js sits between the popup and the LinkedIn tab. When the popup asks for a post's description it runs a script inside the active tab to scrape the text and sends the result back.

popup.js is where the action happens. It has three buttons:

  • Go to Post opens a LinkedIn post URL you paste in
  • Fetch Post Description pulls the post's text and shows a preview comment from Gemini
  • Auto Comment sends the post text to Gemini gets a generated comment types it into LinkedIn's comment box and clicks Comment to publish it

In short the popup asks the background script for the post text the background script scrapes it from the page that text goes to Gemini and the reply comes back as a comment that gets typed in and posted.

Permissions Used

  • activeTab to work with the LinkedIn tab you have open
  • scripting to run code inside the LinkedIn page for reading and posting
  • tabs to read and update the active tab
  • storage reserved for extension settings
  • Host access to linkedin.com so the extension only runs there

Setup

  1. Download or clone the project
  2. Get a Gemini API key from Google AI Studio
  3. Open popup.js and add your key in place of the existing one
  4. Go to chrome://extensions in Chrome and turn on Developer mode
  5. Click Load unpacked and select the project folder
  6. The extension icon should now show up in your toolbar

Usage

  1. Open the LinkedIn post you want to comment on
  2. Click the extension icon
  3. Click Fetch Post Description to see the post text and a suggested comment
  4. Click Auto Comment to have it write and post the comment for you

Limitations

The extension depends on specific LinkedIn page elements so if LinkedIn changes its layout some selectors may stop working. Automating actions like posting comments may also go against LinkedIn's terms of service so this project is meant for learning and demonstration rather than everyday use.

Author

Saim Maqsood — Final Year Project

About

A Chrome extension that generates LinkedIn comments from post content built with JavaScript, Manifest V3 and the Gemini API.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages