Last active
July 16, 2025 00:57
-
-
Save jneuendorf-i4h/d43e867f8a4895c76c10d8e1f7fe740e to your computer and use it in GitHub Desktop.
Download VSIX from VSCode Marketplace URL (e.g. for VSCodium if OpenVSX does not provide the extension)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Based on https://stackoverflow.com/a/38866913/23325241""" | |
import re | |
# Attempt to import requests and handle if it's missing | |
try: | |
import requests | |
requests_available = True | |
except ImportError: | |
requests_available = False | |
def create_download_url(): | |
# Ask the user for the Marketplace URL | |
marketplace_url = input("Enter the VSCode Marketplace URL: ").strip() | |
version = input("Enter the version (leave empty for 'latest'): ").strip() or "latest" | |
# Extract publisher and extension name using regex | |
match = re.search(r"itemName=([^.]+)\.(.+)", marketplace_url) | |
if not match: | |
print("Invalid VSCode Marketplace URL format.") | |
return | |
publisher, extension_name = match.groups() | |
# Generate the download URL | |
download_url = ( | |
f"https://{publisher}.gallery.vsassets.io/_apis/public/gallery/publisher/" | |
f"{publisher}/extension/{extension_name}/{version}/" | |
"assetbyname/Microsoft.VisualStudio.Services.VSIXPackage" | |
) | |
print("\nDownload URL:") | |
print(download_url) | |
if not requests_available: | |
print("The 'requests' library is not installed. Skipping download functionality.") | |
return | |
# Ask the user if they want to download the file | |
download = input("Do you want to download the VSIX file? (yes/no): ").strip().lower() | |
if download == 'yes': | |
response = requests.get(download_url, stream=True) | |
if response.status_code == 200: | |
file_name = f"{extension_name}.vsix" | |
with open(file_name, "wb") as file: | |
for chunk in response.iter_content(chunk_size=8192): | |
file.write(chunk) | |
print(f"File downloaded successfully as '{file_name}'") | |
else: | |
print(f"Failed to download the file. HTTP Status Code: {response.status_code}") | |
else: | |
print("Download skipped.") | |
if __name__ == "__main__": | |
create_download_url() |
Thanks for the feedback. I added the StackOverflow answer, I based the URL template on. The answer is very old so it might be outdated, but I couldn't find another one.
I checked if your suggested URL works for other packages, but GitHub Copilot was the only one that worked (from what I tried). If you find another URL template that works for all/most packages, let me know. In case, GitHub Copilot is one of very few exceptions, I could simply add the URL right on top ^^
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
indeed, also the marketplace page do not have history tab so that might explains . how did you get the working link ?
GitHub.copilot
becameGitHub/vsextensions/copilot
?