Skip to content

Instantly share code, notes, and snippets.

@MasWag
Created June 16, 2025 00:30
Show Gist options
  • Select an option

  • Save MasWag/35c0683e35834057b95c60ee0888cbed to your computer and use it in GitHub Desktop.

Select an option

Save MasWag/35c0683e35834057b95c60ee0888cbed to your computer and use it in GitHub Desktop.
A script to detect possibly non-DBLP entries in a BibTeX file
####################################################################################
# Name
# detect_non_dblp_bibtex.py
# Description
# This script reads a BibTeX file and detectes possibly non-DBLP entries.
# More precisely, it checks each entry for the presence of a 'biburl' field.
# If the 'biburl' field is missing or does not contain 'dblp', it considers the entry
# as possibly non-DBLP and prints the citation key of that entry.
# Usage
# python detect_non_dblp_bibtex.py /path/to/bibtex.bib
# Requirements
# - bibtexparser: install by running `pip install bibtexparser`
# Author
# Masaki Waga
# License
# This script is released under the MIT License.
# Note
# This script can be processed by pandoc with ScrDoc template (https://github.com/maswag/scrdoc).
####################################################################################
import sys
import bibtexparser
def bib_entries(filepath):
with open(filepath, encoding='utf-8') as bibtex_file:
bib_database = bibtexparser.load(bibtex_file)
return bib_database.entries # each entry is a dict
if __name__ == "__main__":
# Get the target BibTeX file from command line arguments
if len(sys.argv) < 2:
print("Usage: python detect_non_dblp_bibtex.py /path/to/bibtex.bib")
sys.exit(1)
bibtex_file = sys.argv[1]
for entry in bib_entries(bibtex_file):
biburl = entry.get('biburl')
# the citation key is stored under 'ID'
key = entry.get('ID')
if biburl is None or 'dblp' not in biburl:
print(key)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment