{"id":17673627,"url":"https://github.com/codetheweb/mtu-webcams","last_synced_at":"2025-05-12T19:27:33.577Z","repository":{"id":35051697,"uuid":"200758251","full_name":"codetheweb/mtu-webcams","owner":"codetheweb","description":"📷 🚨 an easy-to-use API for downloading and streaming from public Michigan Tech webcams","archived":false,"fork":false,"pushed_at":"2022-06-22T16:44:05.000Z","size":971,"stargazers_count":3,"open_issues_count":12,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-28T06:11:32.913Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/codetheweb.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":"2019-08-06T02:02:51.000Z","updated_at":"2024-07-25T20:17:29.000Z","dependencies_parsed_at":"2022-08-30T10:51:41.077Z","dependency_job_id":null,"html_url":"https://github.com/codetheweb/mtu-webcams","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codetheweb%2Fmtu-webcams","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codetheweb%2Fmtu-webcams/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codetheweb%2Fmtu-webcams/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codetheweb%2Fmtu-webcams/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codetheweb","download_url":"https://codeload.github.com/codetheweb/mtu-webcams/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253807584,"owners_count":21967387,"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-24T05:42:40.113Z","updated_at":"2025-05-12T19:27:33.556Z","avatar_url":"https://github.com/codetheweb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mtu-webcams\n\n📷 🚨 an easy-to-use API for downloading and streaming from public Michigan Tech webcams\n\n## Installation\n\n`npm i mtu-webcams`\n\n## Usage\n\nThe below example assumes you have FFMPEG installed and it is in your `$PATH`.\n\nIf you don't have FFMPEG installed or don't want to install it, check out [ffmpeg-static](https://www.npmjs.com/package/ffmpeg-static).\n\n```javascript\nconst fs = require('fs');\nconst Webcams = require('mtu-webcams');\n\nconst cams = new Webcams();\n\n(async () =\u003e {\n  // Get all webcams and save in instance\n  await cams.init();\n\n  // Log discovered webcams\n  console.log(cams.getAll()); // =\u003e [ ... ]\n\n  // Download yesterday's timelapse to 'recording.mp4'\n  const yesterday = new Date(new Date().getTime() - (86400 * 1000));\n\n  cams.byName('Campus Aerial').streamRecording(yesterday).pipe(fs.createWriteStream('recording.mp4'));\n\n  // Get a current snapshot and save to 'snapshot.jpg'\n  cams.byName('Campus Aerial').streamImage().pipe(fs.createWriteStream('snapshot.jpg'));\n\n  // Stream ~5 seconds of video and save to 'stream.flv'\n  const stream = cams.byName('Campus Aerial').streamVideo();\n  stream.pipe(fs.createWriteStream('stream.mp4'));\n\n  setTimeout(() =\u003e {\n    stream.destroy();\n  }, 5000);\n})();\n```\n\n## 📖 Docs\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n#### Table of Contents\n\n-   [Webcams](#webcams)\n    -   [Parameters](#parameters)\n    -   [init](#init)\n    -   [getAll](#getall)\n    -   [byId](#byid)\n        -   [Parameters](#parameters-1)\n    -   [byName](#byname)\n        -   [Parameters](#parameters-2)\n-   [Camera](#camera)\n    -   [Parameters](#parameters-3)\n    -   [getImageURL](#getimageurl)\n    -   [streamImage](#streamimage)\n    -   [getVideoURL](#getvideourl)\n    -   [streamVideo](#streamvideo)\n        -   [Parameters](#parameters-4)\n    -   [getRecordingURL](#getrecordingurl)\n        -   [Parameters](#parameters-5)\n    -   [streamRecording](#streamrecording)\n        -   [Parameters](#parameters-6)\n\n### Webcams\n\nMain cameras class.\n\n#### Parameters\n\n-   `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**  (optional, default `{}`)\n    -   `options.ffmpegPath` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** path to local FFMPEG binary\n\n#### init\n\nScrape Michigan Tech's website to\nretrieve all published webcams.\n\nReturns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\u0026lt;[Camera](#camera)\u003e** discovered cameras\n\n#### getAll\n\nGet all cameras saved in instance.\n\nReturns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\u0026lt;[Camera](#camera)\u003e** \n\n#### byId\n\nGets camera by ID.\n\n##### Parameters\n\n-   `id` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** of camera\n\nReturns **[Camera](#camera)** \n\n#### byName\n\nGets camera by name.\n\n##### Parameters\n\n-   `name` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** of camera\n\nReturns **[Camera](#camera)** \n\n### Camera\n\nMain camera class.\n\n#### Parameters\n\n-   `$0` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**  (optional, default `{}`)\n    -   `$0.imageURL`  \n    -   `$0.name`  \n    -   `$0.description`  \n    -   `$0.ffmpegPath`  \n\n#### getImageURL\n\nReturns the URL to a static snapshot.\n\nReturns **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** \n\n#### streamImage\n\nReturns a stream of the latest static snapshot.\n\nReturns **[stream.Readable](https://nodejs.org/api/stream.html#stream_class_stream_readable)** \n\n#### getVideoURL\n\nReturns the URL to a live `m3u8` playlist.\n\nReturns **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** \n\n#### streamVideo\n\nReturns a live video stream from the webcam.\n\n##### Parameters\n\n-   `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**  (optional, default `{}`)\n    -   `options.format` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** format specifier passed to FFMPEG (optional, default `'flv'`)\n\nReturns **[stream.Readable](https://nodejs.org/api/stream.html#stream_class_stream_readable)** \n\n#### getRecordingURL\n\nReturns the URL for a MP4 recording.\n\n##### Parameters\n\n-   `date` **[Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date)** of recording\n\nReturns **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** \n\n#### streamRecording\n\nReturns a recording as a stream.\n\n##### Parameters\n\n-   `date` **[Date](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date)** of recording to retrieve\n\nReturns **[stream.Readable](https://nodejs.org/api/stream.html#stream_class_stream_readable)** \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodetheweb%2Fmtu-webcams","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodetheweb%2Fmtu-webcams","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodetheweb%2Fmtu-webcams/lists"}