Skip to content

pkhamchuai/mendeley-scholar-checker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“š Mendeley Scholar Checker

A Chrome extension that checks Google Scholar search results against your personal Mendeley library in real time β€” and lets you add papers with a single click.

Chrome Extension Mendeley API License


✨ Features

Badge Meaning Action
βœ… In Mendeley (green) Paper already in your library β€”
βž• Add to Mendeley (blue) Not in library Click to add instantly
βž• Add to Mendeley + PDF (blue) Free PDF detected Click to add with PDF
⏳ Checking… (gray, pulsing) Querying your library Wait
⚠️ Login required (amber) Not connected Click extension icon
  • Matches by DOI first (exact), then fuzzy title match as fallback
  • Auto-saves title, authors, year, journal, and URL to Mendeley when adding
  • Tries to attach a free PDF automatically via Unpaywall and open-access sources
  • Validates downloaded files are real PDFs before attaching (no corrupt files)
  • Works on Google Scholar search results pages
  • Handles dynamic pagination β€” badges appear on newly loaded results too

πŸ—‚ Project Structure

mendeley-scholar-checker/
β”œβ”€β”€ background.js       # OAuth2 + Mendeley API logic (source β€” no real secrets)
β”œβ”€β”€ content.js          # Scrapes Scholar, injects badges, handles click-to-add
β”œβ”€β”€ popup.html          # Extension popup UI (login/logout)
β”œβ”€β”€ popup.js            # Popup logic
β”œβ”€β”€ styles.css          # Badge styles injected into Scholar pages
β”œβ”€β”€ manifest.json       # Chrome Extension Manifest V3 config
β”œβ”€β”€ build.js            # Build script: reads .env β†’ generates dist/
β”œβ”€β”€ get_key.py          # Helper: converts Extension ID β†’ manifest key
β”œβ”€β”€ package.json        # npm scripts
β”œβ”€β”€ .env.example        # Template β€” copy to .env and fill in credentials
β”œβ”€β”€ .gitignore          # Keeps .env and dist/ out of GitHub
β”œβ”€β”€ icons/              # Extension icons (16px, 48px, 128px)
└── dist/               # ← Generated by build.js (gitignored, load THIS in Chrome)

Important: Always load the dist/ folder in Chrome, not the root folder. The dist/ folder contains your credentials injected by the build script.


πŸš€ Quick Start

What you need

  • Google Chrome
  • Node.js v14+ β€” download and install from nodejs.org (just click Next through the installer)
  • A Mendeley / Elsevier account β€” register free at mendeley.com
  • Any text editor β€” Notepad on Windows, TextEdit on Mac, nano in terminal, anything works

No VS Code, no Git, no other tools required.


Step 1 β€” Get the code

Click the green Code button on this GitHub page β†’ Download ZIP β†’ unzip the folder anywhere you like.

Open a terminal inside the unzipped folder:

  • Windows: open the folder β†’ click the address bar β†’ type cmd β†’ press Enter
  • Mac: right-click the folder β†’ "New Terminal at Folder"
  • Linux: right-click β†’ "Open Terminal Here"

Step 2 β€” Do an initial build

In the terminal, run:

node build.js

It will warn about missing credentials β€” that's fine for now. The dist/ folder will still be created.


Step 3 β€” Load the extension in Chrome

  1. Open Chrome and go to chrome://extensions/

  2. Toggle Developer mode ON (switch in the top-right corner)

  3. Click Load unpacked β†’ select the dist/ folder inside the project

  4. Find Mendeley Scholar Checker in the list

  5. Copy the ID shown below the name (only visible when Developer mode is ON):

    ID: abcdefghijklmnopqrstuvwxyzabcdef
    

Step 4 β€” Pin your Extension ID (important!)

Without this step, Chrome assigns a new Extension ID every time you remove and re-add the extension, which breaks the login. Run this once to lock it permanently:

python3 get_key.py abcdefghijklmnopqrstuvwxyzabcdef

Replace the ID with your actual ID from Step 3. On Windows you may need to use python instead of python3.

The output will look like:

βœ…  Extension ID : abcdefghijklmnopqrstuvwxyzabcdef
πŸ”‘  Key          : AAAAAABBBBBBCCCCCC...
πŸ”—  Redirect URL : https://abcdefghijklmnopqrstuvwxyzabcdef.chromiumapp.org/

Copy both the Key and the Redirect URL β€” you need them in the next two steps.


Step 5 β€” Register a Mendeley API app

  1. Go to dev.mendeley.com/myapps.html

  2. Sign in with your Elsevier credentials (same email/password as Mendeley)

  3. Click Create new app and fill in the form:

    Field Value
    App Name Scholar Checker (or anything you like)
    Description Personal Chrome extension to check Mendeley library
    Authorisation Flow Elsevier
    Redirect URL Paste your https://...chromiumapp.org/ from Step 4
  4. Click Register β†’ copy the Client ID and Client Secret shown

⚠️ Do not click "Pack extension" on chrome://extensions/ β€” that's unrelated and not needed here.


Step 6 β€” Configure your credentials

Copy the example credentials file:

# Mac / Linux
cp .env.example .env

# Windows (Command Prompt)
copy .env.example .env

# Windows (PowerShell)
Copy-Item .env.example .env

Open .env with any text editor and fill in all three values:

MENDELEY_CLIENT_ID=paste_your_client_id_here
MENDELEY_CLIENT_SECRET=paste_your_client_secret_here
EXTENSION_KEY=paste_your_key_here

⚠️ Never share this file or commit it to GitHub β€” it's already in .gitignore so it's protected automatically.


Step 7 β€” Build and reload

node build.js

Then go to chrome://extensions/ β†’ find Mendeley Scholar Checker β†’ click ↻ Reload.


Step 8 β€” Connect your Mendeley account

  1. Click the extension icon in the Chrome toolbar (puzzle piece icon β†’ pin it for easy access)
  2. Click Connect Mendeley
  3. An Elsevier login window appears β€” sign in with your Mendeley credentials
  4. The popup shows Connected to Mendeley βœ…

Step 9 β€” Use it!

Go to scholar.google.com, search for any topic, and badges will appear on each result within a few seconds.

  • Blue badge β†’ click to save the paper (+ PDF if one is freely available)
  • Green badge β†’ already in your library

πŸ”„ After Making Changes

If you edit any source file, rebuild and reload:

node build.js

Then chrome://extensions/ β†’ ↻ Reload.


πŸ”’ Security Notes

File Goes to GitHub? Why
.env ❌ No Contains your real secrets
dist/ ❌ No Contains injected secrets
.env.example βœ… Yes Placeholder values only
background.js βœ… Yes Placeholder values only
manifest.json βœ… Yes Placeholder values only

πŸ› Troubleshooting

"Login error: Authorization page could not be loaded"

  • Your Extension ID changed β€” run python3 get_key.py <new-id>, update EXTENSION_KEY in .env, run node build.js, reload, and update the Redirect URL in your Mendeley app settings

"Login error: Token exchange failed: 403"

  • The Redirect URL in Mendeley app settings doesn't match your Extension ID
  • Go to dev.mendeley.com/myapps.html β†’ edit your app β†’ update the Redirect URL

"Login required" badge on every result

  • Click the extension icon β†’ reconnect (token expired)

No badges appearing

  • Make sure you're on a Google Scholar search results page (URL contains scholar.google.com/scholar?)
  • Confirm the popup says "Connected to Mendeley"
  • Try reloading the Scholar page

"Add failed" on a paper

  • Open chrome://extensions/ β†’ click Service worker β†’ Console tab β†’ retry adding β†’ paste the error here

PDF not attached

  • Expected for paywalled papers (IEEE, Elsevier, Springer). The extension only attaches PDFs from free/open-access sources. The paper metadata is always saved regardless.

πŸ“„ License

MIT β€” free to use, modify, and share.

About

Chrome extension that checks whether the paper listed in Google Scholar search results is already in your Mendeley library.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors