simple-site icon indicating copy to clipboard operation
simple-site copied to clipboard

Develop the list extension to present details from Zotero

Open jpadfield opened this issue 4 years ago • 0 comments

Zotero's API allows the details of public collections to be extracted and re-used.

It could be useful for these details to be pull, formatted and presented as part of a simple-site page.

Public collection URLs are in the form: https://www.zotero.org/USERNAME/collections/COLLECTIONCODE

API calls are in the form: https://api.zotero.org/users/USERID/collections/COLLECTIONCODE/items

The USERID is not easy to get from the USERNAME via the API but it can be scraped from any public URL is a section of javascript:

		<script type="application/json" id="zotero-web-library-config">
			{
    "apiConfig": {
        "apiAuthorityPart": "api.zotero.org"
    },
    "streamingApiUrl": "wss:\/\/stream.zotero.org",
    "translateUrl": "https:\/\/t0guvf0w17.execute-api.us-east-1.amazonaws.com\/Prod\/",
    "libraries": {
        "include": [
            {
                "key": "uUSERID",
                "isGroupLibrary": false,
                "name": "USER DISPLAY NAME's Library",
                "slug": "USERNAME"
            }
        ],
        "includeMyLibrary": false,
        "includeUserGroups": false
    }
}		</script>

So given a public URL an extension would need to:

  1. Scrape the USERID
  2. Create the API URL
  3. Pull in the JSON details
  4. Extract what is needed
  5. Format an html based list

Some thought swill need to be given to exactly what data is used and how it should be displayed

jpadfield avatar Aug 02 '21 14:08 jpadfield