fix extension crx download link

This commit is contained in:
Mantao Huang 2026-03-08 11:06:58 -05:00
parent 7e0edaff80
commit b017e208a2
2 changed files with 8 additions and 3 deletions

5
.gitignore vendored
View File

@ -13,4 +13,7 @@ wheels/
.DS_Store .DS_Store
# Chrome profile # Chrome profile
chrome_profile/ chrome_profile/
# Zotero extension
zotero_extension/

View File

@ -9,7 +9,9 @@ import sys
import argparse import argparse
EXTENSION_ID = 'ekhagklcjbdpajgpjgmbionohlpdbjgc' EXTENSION_ID = 'ekhagklcjbdpajgpjgmbionohlpdbjgc'
EXTENSION_URL = f"https://clients2.google.com/service/update2/crx?response=redirect&prodversion=114.0.5735.90&acceptformat=crx2,crx3&x=id%3D{EXTENSION_ID}%2Cinstallsource%3Dondemand%2Cuc"
# Fetch extension directly from the alternative Chrome Webstore endpoint
EXTENSION_URL = f"https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&os_arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=&prodversion=114.0.5735.90&lang=en-US&acceptformat=crx3&x=id%3D{EXTENSION_ID}%26installsource%3Dondemand%26uc"
EXTENSION_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'zotero_extension') EXTENSION_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'zotero_extension')
USER_DATA_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'chrome_profile') USER_DATA_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'chrome_profile')
print(EXTENSION_DIR) print(EXTENSION_DIR)
@ -20,7 +22,7 @@ def setup_extension():
print("[*] Zotero Extension already unpacked locally.") print("[*] Zotero Extension already unpacked locally.")
return os.path.abspath(EXTENSION_DIR) return os.path.abspath(EXTENSION_DIR)
print("[*] Downloading Zotero Connector from Chrome Web Store...") print("[*] Downloading Zotero Connector")
req = urllib.request.Request( req = urllib.request.Request(
EXTENSION_URL, EXTENSION_URL,
headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'} headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'}