- id in plugin => id in release
- remove `currentVersion` - chage `tagName` to real GitHub tag name - add `xpiVersion` - remove all `id` in json
This commit is contained in:
parent
586c2bb3a1
commit
266490b59f
37
README.md
37
README.md
@ -3,23 +3,16 @@
|
||||

|
||||
|
||||
This is a script repository for scraping Zotero addon collections for [Zotero](https://www.zotero.org), intended for use with [Zotero addons](https://github.com/syt2/zotero-addons).
|
||||
|
||||
*Switch to `(addon-scraper)` source in [Zotero addons](https://github.com/syt2/zotero-addons) to use this repository.*
|
||||
> Switch to `(addon-scraper)` source in [Zotero addons](https://github.com/syt2/zotero-addons) to use this repository.
|
||||
|
||||
The script utilizes the GitHub API and GitHub Actions to automatically scrape and parse addon information from the [addons](addons) folder, and publish to [`publish`](https://github.com/syt2/zotero-addons-scraper/blob/publish/addon_infos.json) branch and the latest release every day.
|
||||
|
||||
## Contributing New Addons
|
||||
If you have a new add-on to add, add an add-on information file in the [addons](addons) folder.
|
||||
|
||||
> typically, name it with `repo.replace('/', '#').json`
|
||||
>
|
||||
> If an add-on has different IDs for different Zotero versions, split them into multiple JSON files with different filename.
|
||||
|
||||
The file format should be as follows:
|
||||
|
||||
``` json
|
||||
{
|
||||
"id": "zoteroAddons@ytshen.com",
|
||||
"name": "Zotero Addons",
|
||||
"repo": "syt2/zotero-addons",
|
||||
"releases": [
|
||||
@ -34,18 +27,22 @@ The file format should be as follows:
|
||||
]
|
||||
}
|
||||
```
|
||||
or
|
||||
``` json
|
||||
{
|
||||
"repo": "syt2/zotero-scipdf",
|
||||
"releases": [
|
||||
{
|
||||
"targetZoteroVersion": "7",
|
||||
"tagName": "latest"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
- `name`(optional):
|
||||
The name of the plugin.
|
||||
If not provided, the name will be extracted automatically from the XPI provided in release.
|
||||
- `repo`(required):
|
||||
The GitHub repository address of the plugin.
|
||||
- `releases`(required):
|
||||
Information about the plugin's XPI releases.
|
||||
Provide at least one valid plugin release information.
|
||||
- `targetZoteroVersion`(required):
|
||||
The Zotero compatibility version for the plugin.
|
||||
Supports `"6"` or `"7"`.
|
||||
- `tagName`(required):
|
||||
The release information in the GitHub repository.
|
||||
Supports `"latest"`, `"pre"` or a specified tag name.
|
||||
If `"latest"` or `"pre"` is used, the script will automatically retrieve the latest release information.
|
||||
|
||||
## Generated Format
|
||||
The output format for add-on information follows the format specified in [zotero-chinese/zotero-plugins](https://github.com/zotero-chinese/zotero-plugins).
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
id = "id"
|
||||
name = "name"
|
||||
repo = "repo"
|
||||
releases = "releases"
|
||||
@ -14,6 +13,8 @@ kgithub = "kgithub"
|
||||
releaseData = "releaseData"
|
||||
downloadCount = "downloadCount"
|
||||
assetId = "assetId"
|
||||
id = "id"
|
||||
xpiVersion = "xpiVersion"
|
||||
description = "description"
|
||||
star = "star"
|
||||
author = "author"
|
||||
@ -24,6 +25,7 @@ avatar = "avatar"
|
||||
# from https://github.com/zotero-chinese/zotero-plugins/blob/main/src/plugins.ts
|
||||
# export interface PluginInfo {
|
||||
# // plugin id
|
||||
# // @deprecated This property is deprecated. Use the id in releases instead.
|
||||
# id?: string;
|
||||
#
|
||||
# // plugin name
|
||||
@ -43,7 +45,7 @@ avatar = "avatar"
|
||||
# // `pre`: Latest pre-release
|
||||
# // `string`: Corresponding to the `git.tag_name` of the release;
|
||||
# tagName: "latest" | "pre" | string;
|
||||
#
|
||||
# // @deprecated This property is deprecated. Use tagName instead.
|
||||
# currentVersion?: string;
|
||||
# xpiDownloadUrl?: {
|
||||
# github: string;
|
||||
@ -55,6 +57,10 @@ avatar = "avatar"
|
||||
# releaseData?: string;
|
||||
# downloadCount?: number;
|
||||
# assetId?: number;
|
||||
# // plugin xpi id
|
||||
# id?: string;
|
||||
# // plugin xpi version
|
||||
# xpiVersion?: string;
|
||||
# }>;
|
||||
#
|
||||
# description?: string;
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "zoterozotcard@018.ai",
|
||||
"name": "ZotCard",
|
||||
"repo": "018/zotcard",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "zoplicate@chenglongma.com",
|
||||
"name": "Zoplicate",
|
||||
"repo": "ChenglongMa/zoplicate",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "reading-list@hotmail.com",
|
||||
"name": "Reading List for Zotero",
|
||||
"repo": "Dominic-DallOsto/zotero-reading-list",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "zoterostyle@polygon.org",
|
||||
"name": "Ethereal Style",
|
||||
"repo": "MuiseDestiny/ZoteroStyle",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "zoterocitation@polygon.org",
|
||||
"name": "Eaiser Citation",
|
||||
"repo": "MuiseDestiny/eaiser-citation",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "zoterofigure@polygon.org",
|
||||
"name": "PDF Figure",
|
||||
"repo": "MuiseDestiny/zotero-figure",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "zoterogpt@polygon.org",
|
||||
"name": "Awesome GPT",
|
||||
"repo": "MuiseDestiny/zotero-gpt",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "zoteroreference@polygon.org",
|
||||
"name": "Crush Reference",
|
||||
"repo": "MuiseDestiny/zotero-reference",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "zotero-ocr@bib.uni-mannheim.de",
|
||||
"name": "Zotero OCR",
|
||||
"repo": "UB-Mannheim/zotero-ocr",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "mdnotes@mdnotes.github.io",
|
||||
"name": "Mdnotes for Zotero",
|
||||
"repo": "argenos/zotero-mdnotes",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "zoteroshortdoi@wiernik.org",
|
||||
"name": "Zotero ShortDOI",
|
||||
"repo": "bwiernik/zotero-shortdoi",
|
||||
"releases": [
|
||||
|
||||
@ -1,15 +1,14 @@
|
||||
{
|
||||
"id": "daeda@mit.edu",
|
||||
"name": "MarkDBConnect",
|
||||
"repo": "daeh/zotero-obsidian-citations",
|
||||
"releases": [
|
||||
{
|
||||
"targetZoteroVersion": "6",
|
||||
"tagName": "latest"
|
||||
},
|
||||
{
|
||||
"targetZoteroVersion": "7",
|
||||
"tagName": "pre"
|
||||
},
|
||||
{
|
||||
"targetZoteroVersion": "6",
|
||||
"tagName": "latest"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "notero@vanoni.dev",
|
||||
"name": "Notero",
|
||||
"repo": "dvanoni/notero",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "schnetter@gmail.com",
|
||||
"name": "Zotero Citation Counts Manager",
|
||||
"repo": "eschnett/zotero-citationcounts",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "scihub@example.com",
|
||||
"name": "Sci-Hub Plugin for Zotero",
|
||||
"repo": "ethanwillis/zotero-scihub",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "zoteroinspire@itp.ac.cn",
|
||||
"name": "Zotero Inspire",
|
||||
"repo": "fkguo/zotero-inspire",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "betterauthors@github.com",
|
||||
"name": "Zotero Better Authors",
|
||||
"repo": "github-young/zotero-better-authors",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "zotfile@columbia.edu",
|
||||
"name": "ZotFile",
|
||||
"repo": "jlegewie/zotfile",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "jasminum@linxzh.com",
|
||||
"name": "Jasminum",
|
||||
"repo": "l0o0/jasminum",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "tara@linxzh.com",
|
||||
"name": "Tara",
|
||||
"repo": "l0o0/tara",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "zotfile@columbia.edu",
|
||||
"name": "ZotFile 汉化版",
|
||||
"repo": "lychichem/zotfile",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "zotero-format-metadata@northword.cn",
|
||||
"name": "Linter for Zotero",
|
||||
"repo": "northword/zotero-format-metadata",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "delitemwithatt@redleaf.me",
|
||||
"name": "DelItemWithAtt",
|
||||
"repo": "redleafnew/delitemwithatt",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "zoteroupdateifs@redleafnew.me",
|
||||
"name": "Zotero 更新影响因子",
|
||||
"repo": "redleafnew/zotero-updateifs",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "greenfrog@redleafnew.me",
|
||||
"name": "Green Frog",
|
||||
"repo": "redleafnew/zotero-updateifsE",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "better-bibtex@iris-advies.com",
|
||||
"name": "Better BibTex for Zotero",
|
||||
"repo": "retorquere/zotero-better-bibtex",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "open-pdf@iris-advies.com",
|
||||
"name": "Open PDF",
|
||||
"repo": "retorquere/zotero-open-pdf",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "pmcid-fetcher@iris-advies.com",
|
||||
"name": "PMCID fetcher for Zotero",
|
||||
"repo": "retorquere/zotero-pmcid-fetcher",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "storage-scanner@iris-advies.com",
|
||||
"name": "Zotero Storage Scanner",
|
||||
"repo": "retorquere/zotero-storage-scanner",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "scite@scite.ai",
|
||||
"name": "scite Plugin for Zotero",
|
||||
"repo": "scitedotai/scite-zotero-plugin",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "zoterotldr@syt.com",
|
||||
"name": "Zotero TL;DR",
|
||||
"repo": "syt2/Zotero-TLDR",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "zoteroAddons@ytshen.com",
|
||||
"name": "Zotero Addons",
|
||||
"repo": "syt2/zotero-addons",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "scipdf@ytshen.com",
|
||||
"name": "Sci-PDF",
|
||||
"repo": "syt2/zotero-scipdf",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "night@tefkah.com",
|
||||
"name": "Night for Zotero",
|
||||
"repo": "tefkah/zotero-night",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "chartero@volatile.static",
|
||||
"name": "Chartero",
|
||||
"repo": "volatile-static/Chartero",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "zoterotag@euclpts.com",
|
||||
"name": "Actions and Tags for Zotero",
|
||||
"repo": "windingwind/zotero-actions-tags",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "Knowledge4Zotero@windingwind.com",
|
||||
"name": "Better Notes for Zotero",
|
||||
"repo": "windingwind/zotero-better-notes",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "pdfpreview@windingwind.com",
|
||||
"name": "Preview for Zotero",
|
||||
"repo": "windingwind/zotero-pdf-preview",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "zoteropdftranslate@euclpts.com",
|
||||
"name": "Translate for Zotero",
|
||||
"repo": "windingwind/zotero-pdf-translate",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "zutilo@www.wesailatdawn.com",
|
||||
"name": "Zutilo Utility for Zotero",
|
||||
"repo": "wshanks/Zutilo",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "lyz@zotero.org",
|
||||
"name": "LyZ",
|
||||
"repo": "wshanks/lyz",
|
||||
"releases": [
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{
|
||||
"id": "keepzotero@yhmtsai",
|
||||
"name": "KeepZotero",
|
||||
"repo": "yhmtsai/KeepZotero",
|
||||
"releases": [
|
||||
|
||||
30
main.py
30
main.py
@ -108,6 +108,10 @@ def parse(plugin, **kwargs):
|
||||
else:
|
||||
continue
|
||||
if 'tag_name' in release_info:
|
||||
release[tagName] = release_info['tag_name']
|
||||
# todo: 删除currentVersion
|
||||
# zotero-addons插件相关:
|
||||
# 等待影响降低后再删除 (影响2023-12-14日之前的版本)
|
||||
release[currentVersion] = release_info['tag_name']
|
||||
|
||||
if 'assets' not in release_info:
|
||||
@ -152,30 +156,18 @@ def parse(plugin, **kwargs):
|
||||
details = addon_details(xpi_filepath)
|
||||
except Exception as e:
|
||||
print(f'fetch addon detail of {plugin[repo]} failed: {e}')
|
||||
# 对齐zotero-chinese的格式
|
||||
# if details:
|
||||
# xpi_info = {}
|
||||
# if "id" in details:
|
||||
# xpi_info[id] = details["id"]
|
||||
# if "name" in details:
|
||||
# xpi_info[name] = details["name"]
|
||||
# if "version" in details:
|
||||
# xpi_info[currentVersion] = details["version"]
|
||||
# if xpi_info:
|
||||
# release[xpiInfo] = xpi_info
|
||||
|
||||
if details:
|
||||
if detail_id := details.get('id'):
|
||||
if plugin.get(id) and plugin[id] != detail_id:
|
||||
print('🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘')
|
||||
print(f'Addon id not matched in {plugin[repo]}')
|
||||
print(f'{plugin[id]} <===> {detail_id}')
|
||||
print('🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘🆘')
|
||||
release[id] = detail_id
|
||||
# todo: 删除plugin外层的id
|
||||
# zotero-addons插件相关:
|
||||
# 等待影响降低后再删除 (影响2023-12-14日之前的版本)
|
||||
plugin[id] = detail_id
|
||||
if not plugin.get(name) and (detail_name := details.get('name')):
|
||||
plugin[name] = detail_name
|
||||
if not release.get(currentVersion) and (detail_version := details.get('version')):
|
||||
release[currentVersion] = detail_version
|
||||
if detail_version := details.get('version'):
|
||||
release[xpiVersion] = detail_version
|
||||
if not plugin.get(description) and (detail_desc := details.get('description')):
|
||||
if detail_desc != '__MSG_description__':
|
||||
plugin[description] = detail_desc
|
||||
@ -260,7 +252,7 @@ def create_release(github_repository, **kwargs):
|
||||
'tag_name': f'{cur_time}',
|
||||
'target_commitish': 'master',
|
||||
'name': f'{cur_time}',
|
||||
'body': 'publish addon_infos.json',
|
||||
'body': f'\npublish addon_infos.json',
|
||||
'draft': False,
|
||||
'prerelease': False,
|
||||
'generate_release_notes': False,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user