{"id":15145766,"url":"https://github.com/rn0x/downlib","last_synced_at":"2025-10-24T01:30:19.242Z","repository":{"id":245968113,"uuid":"819689019","full_name":"rn0x/downlib","owner":"rn0x","description":"A powerful library for downloading videos and files from various platforms.","archived":false,"fork":false,"pushed_at":"2024-08-02T00:21:02.000Z","size":52968,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-09-27T11:42:35.006Z","etag":null,"topics":["dailymotion","download","facebook","instagram","javascript","library","reddit","soundcloud","tiktok","twitter","youtube","yt-dlp"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/downlib","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/rn0x.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-06-25T02:36:49.000Z","updated_at":"2024-08-02T00:21:05.000Z","dependencies_parsed_at":"2024-08-02T01:41:20.450Z","dependency_job_id":"0a452a11-c698-49aa-8257-65f6d911cdb6","html_url":"https://github.com/rn0x/downlib","commit_stats":null,"previous_names":["rn0x/downlib"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rn0x%2Fdownlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rn0x%2Fdownlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rn0x%2Fdownlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rn0x%2Fdownlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rn0x","download_url":"https://codeload.github.com/rn0x/downlib/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219867315,"owners_count":16555821,"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":["dailymotion","download","facebook","instagram","javascript","library","reddit","soundcloud","tiktok","twitter","youtube","yt-dlp"],"created_at":"2024-09-26T11:42:39.709Z","updated_at":"2025-10-24T01:30:18.904Z","avatar_url":"https://github.com/rn0x.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Downlib\n\nDownlib is a Node.js class for downloading content from various popular websites such as YouTube, Instagram, and TikTok. It uses tools like `yt-dlp` for YouTube downloads and handles downloading media from Instagram and TikTok.\n\n\u003cdiv align=\"center\"\u003e\n\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/rn0x/downlib/blob/main/LICENSE)\n[![npm version](https://badge.fury.io/js/downlib.svg)](https://badge.fury.io/js/downlib)\n![VIEWS](https://komarev.com/ghpvc/?username=rn0x-downlib\u0026label=REPOSITORY+VIEWS\u0026style=for-the-badge)\n\n\u003c/div\u003e\n\n## Installation\n\nTo use Downlib, first install it via npm:\n\n```bash\nnpm install downlib\n```\n\n## Usage\n\n### Example Usage\n\n```javascript\nimport Downlib from 'downlib';\n\n// Initialize Downlib with optional configurations\nconst downlib = new Downlib({\n    ytDlpPath: '', // Optional: Specify the path for yt-dlp if needed\n    deleteAfterDownload: true,\n});\n\n// Example: Download a video from YouTube\nconst youtubeUrl = 'https://www.youtube.com/watch?v=yourvideoid';\nconst saveDir = './downloads';\ndownlib.downloadFromYouTube(youtubeUrl, saveDir, { audioOnly: false })\n  .then((result) =\u003e {\n    console.log('Downloaded video information:', result);\n  })\n  .catch((error) =\u003e {\n    console.error('Error downloading video:', error);\n  });\n\n// Example: Download media from Instagram\nconst instagramUrl = 'https://www.instagram.com/p/yourpostid/';\ndownlib.downloadFromInstagram(instagramUrl, saveDir)\n  .then((result) =\u003e {\n    console.log('Downloaded Instagram media:', result);\n  })\n  .catch((error) =\u003e {\n    console.error('Error downloading Instagram media:', error);\n  });\n\n// Example: Download video from TikTok\nconst tiktokUrl = 'https://www.tiktok.com/@username/video/123456789';\ndownlib.downloadFromTikTok(tiktokUrl, saveDir)\n  .then((result) =\u003e {\n    console.log('Downloaded TikTok video:', result);\n  })\n  .catch((error) =\u003e {\n    console.error('Error downloading TikTok video:', error);\n  });\n\n// Example: Determine the type of a URL\nconst urlToCheck = 'https://www.reddit.com/r/javascript/';\nconst urlType = downlib.checkUrlType(urlToCheck);\nconsole.log(`URL '${urlToCheck}' is of type '${urlType}'.`);\n// Output: URL 'https://www.reddit.com/r/javascript/' is of type 'Reddit'.\n\n// You can also explore more methods provided by Downlib for other functionalities.\n```\n\n\n#### `class Downlib`\n\n##### Constructor\n\n```javascript\n/**\n * Initialize Downlib with optional configurations.\n * @param {object} options - Optional configurations.\n */\nconst downlib = new Downlib(options);\n```\n\n##### Methods\n\n- `ensureDirectoryExists(dirPath)`: Ensures that a directory exists at the specified path. Creates the directory if it doesn't already exist.\n- `deleteFile(filepath)`: Deletes a file from the filesystem.\n- `downloadFromInstagram(url, saveDir)`: Downloads media (photos or videos) from Instagram using `instagramGetUrl` and Axios. It handles multiple media files if available.\n- `downloadFromYouTube(url, saveDir, options)`: Downloads videos or playlists from YouTube using `yt-dlp`. Supports options like `audioOnly` to download only audio.\n- `downloadFromTikTok(url, saveDir)`: Downloads videos from TikTok using a custom function (`tiktokdl`).\n- `downloadFromTwitter(url, saveDir)`: Downloads videos from Twitter using `yt-dlp`.\n- `downloadFromFacebook(url, saveDir, options)`: Downloads videos from Facebook using `yt-dlp`.\n- `downloadFromTwitch(url, saveDir, options)`: Downloads videos from Twitch using `yt-dlp`.\n- `downloadFromDailymotion(url, saveDir, options)`: Downloads videos from Dailymotion using `yt-dlp`.\n- `downloadFromSoundCloud(url, saveDir)`: Downloads audio tracks from SoundCloud using `yt-dlp`.\n- `downloadFromReddit(url, saveDir, options)`: Downloads videos from Reddit using `yt-dlp`.\n- `checkUrlType(url)`: Checks the type of a URL and returns the corresponding social media platform or streaming service (YouTube, Instagram, TikTok, Pinterest, Facebook, Twitter, Reddit, SoundCloud, Dailymotion, Twitch). If the URL doesn't match any recognized patterns, it returns `'Unknown'`.\n\n#### Example Code\n\nSee examples above for usage of each method.\n\n### Configuration Options\n\nYou can pass optional configurations when initializing `Downlib`. These options include:\n\n- `options.ytDlpPath`: Path to yt-dlp executable.\n- `options.deleteAfterDownload`: Whether to delete the downloaded files after completion.\n\n### Issues\n\nIf you encounter any issues or have suggestions, please open an issue [here](https://github.com/rn0x/downib/issues).\n\n### License\n\nThis project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frn0x%2Fdownlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frn0x%2Fdownlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frn0x%2Fdownlib/lists"}