coins-parser

Parses and creates COinS metadata tags. Can be used with Zotero.

https://github.com/willynilly/coins-parser

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.3%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Parses and creates COinS metadata tags. Can be used with Zotero.

Basic Info
  • Host: GitHub
  • Owner: willynilly
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 22.5 KB
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 1
Created 10 months ago · Last pushed 10 months ago
Metadata Files
Readme License Citation

README.md

coins-parser

Parses and creates COinS metadata tags. Can be used with Zotero.

PyPI - Version Python Version from PEP 621 TOML


Table of Contents

Installation

console pip install coins-parser

Usage

Zotero allows you to export references as COinS tags. You can use this package to parse them and use them in your Python packages. This package offers a CoinsParser class that can parse an HTML string containing COinS tags into a Python list. This list contains a list of COinS metadata for each COinS span tag found in the HTML string.

```python

parse several COinS tags from an HTML string (it will ignore the other HTML elements)

from coins_parser import CoinsParser

htmlwithcoinstags: str = """ <span class="Z3988" title="urlver=Z39.88-2004&ctxver=Z39.88-2004&rfrid=info%3Asid%2Fzotero.org%3A2&rftvalfmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&rft.type=computerProgram&rft.title=MyOtherApp&rft.publisher=Some+Other+Company&rft.description=This+is+another+example+dummy+software+for+testing.&rft.identifier=https%3A%2F%2Fzenodo.org%2Frecords%2Fsomenumber2&rft.aufirst=Willa&rft.aulast=Biley&rft.au=Willa+Biley&rft.au=Wil%C3%B2+Ril%C3%BC&rft.au=Jil+van+Hilo&rft.date=2025-04-20">

"""

print metadata for each found COinS tag

coinspans: CoinSpanList = CoinsParser.parse(htmlwithcoinstags) for coinspan in coinspans: print(coin_span) ```

You can also specify the HTML parser used to any parser supported by beautifulsoup4. By default, the HTML parser is 'html.parser', which does not require installing additional packages. However, if you want to use a different HTML parser, like 'lxml', you will first need to install it as described in the previous link.

```python

parse the COinS tags using the lxml parser

coinspans: CoinSpanList = CoinsParser.parse(htmlwithcoinstags, beautifulsoupparser='lxml') ```

You can covert COinS objects back into HTML. This can be useful if you want to inject one or more COinS span tags into your webpage so Zotero can recognize one or more items on a single page.

```python

Create two COinS objects

from coins_parser import CoinsParser

coinspan1: CoinSpan = [ ("urlver", "Z39.88-2004"), ("ctxver", "Z39.88-2004"), ("rfrid", "info:sid/zotero.org:2"), ("rftval_fmt", "info:ofi/fmt:kev:mtx:dc"), ("rft.type", "computerProgram"), ("rft.title", "MyApp"), ("rft.publisher", "Some Company"), ("rft.description", "This is an example dummy software for testing."), ("rft.identifier", "https://zenodo.org/records/somenumber1"), ("rft.aufirst", "Willa"), ("rft.aulast", "Biley"), ("rft.au", "Willa Biley"), ("rft.au", "Wilò Rilü"), ("rft.au", "Jil van Hilo"), ("rft.date", "2025-04-15"), ]

coinspan2: CoinSpan = [ ("urlver", "Z39.88-2004"), ("ctxver", "Z39.88-2004"), ("rfrid", "info:sid/zotero.org:2"), ("rftvalfmt", "info:ofi/fmt:kev:mtx:dc"), ("rft.type", "computerProgram"), ("rft.title", "MyOtherApp"), ("rft.publisher", "Some Company"), ("rft.description", "This is another example dummy software for testing."), ("rft.identifier", "https://zenodo.org/records/somenumber2"), ("rft.aufirst", "Willa"), ("rft.aulast", "Biley"), ("rft.au", "Willa Biley"), ("rft.au", "Wilò Rilü"), ("rft.au", "Jil van Hilo"), ("rft.date", "2025-04-11"), ] coinspans: list[CoinSpan] = [coinspan1, coinspan2] html: str = CoinsParser.html(coin_spans)
print(html) ```

License

coins-parser is distributed under the terms of the Apache 2.0 license

Contribution

Contributions in the form of feature requests, bug reports, bug fixes, tests, and feature implementations are welcome. To contribute code, please fork the project, and then do a pull request.

Developer Notes

Building Locally

To build the tool locally, please follow the general advice from here.

python3 -m pip install --upgrade build python3 -m build

Deploying

To deploy the tool, use the Github Action defined in .github/workflows/python-publish.yml

Owner

  • Name: Will Riley
  • Login: willynilly
  • Kind: user
  • Location: Arnhem, The Nederlands
  • Company: Wageningen University & Research

Ph.D. in Educational Psychology (Applied Cognition and Development) from University of Georgia

Citation (CITATION.cff)

cff-version: 1.2.0
title: coins-parser
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Will
    family-names: Riley
    email: wanderingwill@gmail.com
    orcid: "https://orcid.org/0000-0003-1822-6756"
repository-code: >-
  https://github.com/willynilly/coins-parser
abstract: >-
  Parses and creates COinS metadata tags. Can be used with Zotero.
keywords:
  - COinS
  - Zotero
  - parser
  - citation
  - metadata
license: Apache-2.0
version: "2.0.0"
date-released: "2025-05-02"
references:
  - title: Beautiful Soup
    type: software
    version: 4.13.4
    authors:
    - name: "Leonard Richardson"
      email: leonardr@segfault.org
    repository-code: https://code.launchpad.net/beautifulsoup
    license: MIT

GitHub Events

Total
  • Release event: 7
  • Watch event: 1
  • Delete event: 1
  • Push event: 8
  • Create event: 9
Last Year
  • Release event: 7
  • Watch event: 1
  • Delete event: 1
  • Push event: 8
  • Create event: 9

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 57 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 6
  • Total maintainers: 1
pypi.org: coins-parser

Parses and creates COinS metadata tags. Can be used with Zotero.

  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 57 Last month
Rankings
Dependent packages count: 9.2%
Average: 30.5%
Dependent repos count: 51.9%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/python-publish.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
  • pypa/gh-action-pypi-publish 27b31702a0e7fc50959f5ad993c78deac1bdfc29 composite
pyproject.toml pypi
  • beautifulsoup4 >=4.13.4