{"id":17983498,"url":"https://github.com/techjacker/go-get-assets","last_synced_at":"2025-04-04T02:13:01.712Z","repository":{"id":19510292,"uuid":"22757000","full_name":"techjacker/go-get-assets","owner":"techjacker","description":"Download google drive assets listed in a JSON file","archived":false,"fork":false,"pushed_at":"2016-07-05T14:57:10.000Z","size":4630,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-09T13:36:58.939Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/techjacker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-08T12:24:43.000Z","updated_at":"2016-03-11T14:25:53.000Z","dependencies_parsed_at":"2022-08-23T16:20:19.713Z","dependency_job_id":null,"html_url":"https://github.com/techjacker/go-get-assets","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techjacker%2Fgo-get-assets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techjacker%2Fgo-get-assets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techjacker%2Fgo-get-assets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techjacker%2Fgo-get-assets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/techjacker","download_url":"https://codeload.github.com/techjacker/go-get-assets/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247107828,"owners_count":20884797,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-29T18:17:24.612Z","updated_at":"2025-04-04T02:13:01.690Z","avatar_url":"https://github.com/techjacker.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-get-assets\n\nDownload the google drive assets contained in a JSON file. Use Google Drive as your CMS.\n\n\n----------------------------------\n\n## Installation\n\n```Shell\ngo get github.com/techjacker/go-get-assets\n```\n\n----------------------------------\n\n## Usage\n\n### CLI\n\n```Shell\n$ go-get-assets \u003cinput-json\u003e \u003cdownload-dir\u003e\n```\n\n#### CLI Options\n```\n$ go-get-assets -r \u003crewrite-urls-stem\u003e -o \u003coutput-JSON-path\u003e -n \u003cneedle\u003e \u003cinput-json\u003e \u003cdownload-dir\u003e\n```\nstem to replace downloaded URLs in rewritten JSON file\n```\n-r \u003crewrite-urls-stem\u003e\n```\n\npath to write rewritten JSON file\n```\n-o \u003coutput-JSON-path\u003e\n```\n\nneedle to use to look for download URLs (defaults to Google drive stem)\n```\n-n \u003cneedle\u003e\n```\nshow help\n```\n$ go-get-assets -h\n```\n\n\n----------------------------------\n\n## Examples\n\n### Example 1\n\nJust downloads the assets from Google Drive.\n\n```Shell\n$ go-get-assets $PWD/cms.json $PWD/images\n```\n\n### Example 2\n\nDownloads the assets from Google Drive and saves new JSON file with paths to assets rewritten. \n\n```Shell\n$ go-get-assets -r /images -o $PWD/cms.output.json $PWD/cms.json $PWD/images\n```\n\n#### BEFORE\n```\n$ cat cms.json\n{\n    \"clients\": [{\n        \"name\": \"Samsung\",\n        \"photourl\": \"https://drive.google.com/file/d/city.jpg\"\n    }],\n    \"photourl\": \"https://drive.google.com/file/d/freedom.jpg, https://drive.google.com/file/d/traffic.jpg\"\n}\n```\n\n#### AFTER\n```\n$ ls -l images\n images/city.jpg\n images/freedom.jpg\n images/traffic.jpg\n```\n\n```\n$ cat cms.output.json\n{\n    \"clients\": [{\n        \"name\": \"Samsung\",\n        \"photourl\": \"/images/city.jpg\"\n    }],\n    \"photourl\": \"/images/freedom.jpg, /images/traffic.jpg\"\n}\n```\n\n\n----------------------------------\n\n## How it works\n\nDownloads public files from gdrive by constructing URLs based on the following logic.\n\nCopy a google drive share link of a public file, eg:\n`https://drive.google.com/file/d/\u003cID\u003e`\nEg:\n`https://drive.google.com/file/d/0ByPfUp1fLihSNm5SSjZoalhPQ3M/view?usp=sharing`\n\nExtract the ID to construct the download URL.\n`https://googledrive.com/host/\u003cID\u003e`\nEg:\n`https://googledrive.com/host/0ByPfUp1fLihSNm5SSjZoalhPQ3M`\n\nWGET or similar the file. Make sure you enable following redirects.\n\nThe downloaded file is named after the ID, eg:\n`/path/to/file/0ByPfUp1fLihSNm5SSjZoalhPQ3M`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechjacker%2Fgo-get-assets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftechjacker%2Fgo-get-assets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechjacker%2Fgo-get-assets/lists"}