{"id":24784363,"url":"https://github.com/dashutosh04/nasa-apod-fetcher","last_synced_at":"2025-08-26T16:32:20.224Z","repository":{"id":256480838,"uuid":"855416236","full_name":"dashutosh04/nasa-apod-fetcher","owner":"dashutosh04","description":"NASA APOD Data Fetcher is a Node.js library that provides a simple way to access and retrieve data from NASA's Astronomy Picture of the Day (APOD) API. It allows you to easily fetch information about the daily featured image, including its copyright, date, explanation, media type, and more.","archived":false,"fork":false,"pushed_at":"2024-09-10T21:44:28.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-29T13:14:09.053Z","etag":null,"topics":["apod","nasa","nasa-api","nasa-apod","nasa-apod-api"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/dashutosh04.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-10T20:41:26.000Z","updated_at":"2024-10-05T16:40:30.000Z","dependencies_parsed_at":"2024-09-11T02:04:05.216Z","dependency_job_id":"755fc19c-b0cf-4254-9a68-835b62af2722","html_url":"https://github.com/dashutosh04/nasa-apod-fetcher","commit_stats":null,"previous_names":["dashutosh04/nasa-apod-fetcher"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashutosh04%2Fnasa-apod-fetcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashutosh04%2Fnasa-apod-fetcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashutosh04%2Fnasa-apod-fetcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashutosh04%2Fnasa-apod-fetcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dashutosh04","download_url":"https://codeload.github.com/dashutosh04/nasa-apod-fetcher/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245231872,"owners_count":20581689,"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":["apod","nasa","nasa-api","nasa-apod","nasa-apod-api"],"created_at":"2025-01-29T13:14:10.880Z","updated_at":"2025-03-24T07:47:07.780Z","avatar_url":"https://github.com/dashutosh04.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"##  🚀 NASA APOD Data Fetcher\n\n### 📝 Description\n\nThis `Node.js` project provides a set of functions to fetch data from *NASA's Astronomy Picture of the Day (APOD)* API. It allows you to easily retrieve information about the daily featured image, including its copyright, date, explanation, media type, and more.\n\n### 💫 Features\n\n- Fetches complete APOD data using your NASA API key.\n- Extracts specific properties like copyright, date, explanation, HD URL, media type, service version, title, and image URL.\n- Handles errors gracefully by logging them and returning default values for missing data.\n- Improved Security: Explicitly checks for missing API keys and throws informative errors.\n\n### 💻 Installation\n\n1. **Clone the repository:**\n\n```bash\ngit clone https://github.com/dashutosh04/nasa-apod.git\n```\n\n2. **Install dependencies:**\n\n```bash\nnpm install\n```\n\n3. **Set NASA API Key:**\n\nYou'll need a NASA API key. Obtain one from https://api.nasa.gov/ and set it as an environment variable named `NASA_API_KEY`.\n\n### ✒️ Usage\n\n#### Import the functions:\n\n```js\nimport {\n  getData,\n  getCopyright,\n  getDate,\n  getExplanation,\n  getHdurl,\n  getMediaType,\n  getServiceVersion,\n  getTitle,\n  getImageUrl,\n} from \"./index.js\"; // imports all the functions;\n```\n```js\nimport * as APOD from \"./index.js\"; // imports all the functions;\n```\n\n### Example usage:\n\n```JavaScript\nconst apiKey = process.env.NASA_API_KEY;\n\ngetCopyright(apiKey)\n.then(copyright =\u003e console.log(\"Copyright:\", copyright))\n.catch(error =\u003e console.error(error));\n\ngetDate(apiKey)\n.then(date =\u003e console.log(\"Date:\", date))\n.catch(error =\u003e console.error(error));\n\n```\n\n### 🤝 Contributing\n\nFeel free to submit pull requests or issues on GitHub!\n\n### License\n\nMIT License\n\n#### Additional Information\n\n- The `BASE_URL` for the API is set using an environment variable (NASA_API_URL) for security reasons. If not provided, it defaults to the public API URL.\n- The code is well-structured with modular functions for each property retrieval.\n- Error handling ensures the code gracefully handles potential issues during API calls.\n- It now includes improved security by explicitly checking for a missing API key and throwing an informative error message to guide users on setting it up.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdashutosh04%2Fnasa-apod-fetcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdashutosh04%2Fnasa-apod-fetcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdashutosh04%2Fnasa-apod-fetcher/lists"}