Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jrichardsz/059caa0dc4d19fa70b5b4df23df0eb96 to your computer and use it in GitHub Desktop.
Save jrichardsz/059caa0dc4d19fa70b5b4df23df0eb96 to your computer and use it in GitHub Desktop.
One Liner to Download the Latest Release from Github Repo

Using this repository https://api.github.com/repos/pdf2htmlEX/pdf2htmlEX/releases/latest

With an asset name of pdf2htmlEX-0.18.8.rc1-master-20200630-Ubuntu-bionic-x86_64.deb

{
  "url": "https://api.github.com/repos/pdf2htmlEX/pdf2htmlEX/releases/assets/22311467",
  "id": 22311467,
  "node_id": "MDEyOlJlbGVhc2VBc3NldDIyMzExNDY3",
  "name": "pdf2htmlEX-0.18.8.rc1-master-20200630-Ubuntu-bionic-x86_64.deb",
  "label": "",
  "uploader": {
    "login": "stephengaito",
    "id": 1078196,
    "node_id": "MDQ6VXNlcjEwNzgxOTY=",
    "avatar_url": "https://avatars.githubusercontent.com/u/1078196?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/stephengaito",
    "html_url": "https://github.com/stephengaito",
    "followers_url": "https://api.github.com/users/stephengaito/followers",
    "following_url": "https://api.github.com/users/stephengaito/following{/other_user}",
    "gists_url": "https://api.github.com/users/stephengaito/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/stephengaito/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/stephengaito/subscriptions",
    "organizations_url": "https://api.github.com/users/stephengaito/orgs",
    "repos_url": "https://api.github.com/users/stephengaito/repos",
    "events_url": "https://api.github.com/users/stephengaito/events{/privacy}",
    "received_events_url": "https://api.github.com/users/stephengaito/received_events",
    "type": "User",
    "site_admin": false
  },
  "content_type": "application/x-debian-package",
  "state": "uploaded",
  "size": 4561732,
  "download_count": 32103,
  "created_at": "2020-06-30T14:42:24Z",
  "updated_at": "2020-06-30T14:43:00Z",
  "browser_download_url": "https://github.com/pdf2htmlEX/pdf2htmlEX/releases/download/v0.18.8.rc1/pdf2htmlEX-0.18.8.rc1-master-20200630-Ubuntu-bionic-x86_64.deb"
}

This get the full url (browser_download_url) this line worked for me

curl -s https://api.github.com/repos/pdf2htmlEX/pdf2htmlEX/releases/latest  | jq -r '.assets[] | select(.name=="pdf2htmlEX-0.18.8.rc1-master-20200630-Ubuntu-bionic-x86_64.deb").browser_download_url'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment