ianfortier/loom-downloader 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ianfortier/loom-downloader

Composer 安装命令:

composer require ianfortier/loom-downloader

包简介

Loom Downloader is a simple PHP package to download videos from loom.com

README 文档

README

A simple PHP package to download Loom videos with ease.

🚀 Installation

Install the package via Composer:

composer require ianfortier/loom-downloader

🤔 Why?

Loom doesn't provide an official API for video downloads. This package fills that gap, allowing you to:

  • Create backups of your Loom videos
  • Archive old content
  • Have offline access to your videos

Use responsibly and only for videos you have the right to download and store.

🔧 Usage Examples

The LoomDownloader class provides two main methods for working with Loom videos: downloadVideo and saveVideo.

Download Video Content

To download the video content and get it as a binary:

use LoomDownloader\LoomDownloader;

$downloader = new LoomDownloader();
$videoContent = $downloader->downloadVideo('https://www.loom.com/share/your-video-id');

// $videoContent now contains the binary data of the video
// Be cautious with this method for large videos as it loads the entire video into memory

Save Video to File

To download the video and save it directly to a file:

use LoomDownloader\LoomDownloader;

$downloader = new LoomDownloader();
$filePath = $downloader->saveVideo('https://www.loom.com/share/your-video-id', '/path/to/save/video.mp4');

echo "Video saved to: " . $filePath;

If you don't specify a destination, the video will be saved to a temporary directory:

$filePath = $downloader->saveVideo('https://www.loom.com/share/your-video-id');
echo "Video saved to: " . $filePath;

🛠 Laravel Integration

While this package can be used in any PHP project, here are some examples of how you can integrate it with Laravel:

Basic Usage in a Controller

use LoomDownloader\LoomDownloader;

class LoomController extends Controller
{
    public function download(Request $request)
    {
        $downloader = new LoomDownloader();
        $filePath = $downloader->saveVideo($request->loom_url, storage_path('app/videos/loom_video.mp4'));
        
        return response()->download($filePath);
    }

    public function stream(Request $request)
    {
        $downloader = new LoomDownloader();
        $videoContent = $downloader->downloadVideo($request->loom_url);
        
        return response($videoContent)
            ->header('Content-Type', 'video/mp4')
            ->header('Content-Disposition', 'inline; filename="loom_video.mp4"');
    }
}

Error Handling with Laravel Logging

use Illuminate\Support\Facades\Log;
use LoomDownloader\LoomDownloader;

class LoomController extends Controller
{
    public function download(Request $request)
    {
        try {
            $downloader = new LoomDownloader();
            $filePath = $downloader->saveVideo($request->loom_url, storage_path('app/videos/loom_video.mp4'));
            return response()->download($filePath);
        } catch (\Exception $e) {
            Log::error('Failed to download Loom video: ' . $e->getMessage());
            return response()->json(['error' => 'Failed to download video'], 500);
        }
    }
}

ℹ️ Important Information

Before using this package, please be aware of the following:

  1. Video Access: This package attempts to download Loom videos based on their ID. It does not implement authentication, so its ability to access private videos depends on Loom's API behavior. Use caution and respect video owners' privacy settings.

  2. Error Handling: The package throws exceptions for invalid URLs, unavailable videos, or API errors. Make sure to handle these exceptions in your code.

  3. Video Quality: Videos are downloaded in the format provided by Loom's API. There are no options to select different qualities or formats.

  4. Large Videos: While the package can handle large files, be cautious when using the downloadVideo method as it loads the entire video into memory. For large videos, prefer the saveVideo method which streams the video directly to a file.

  5. Legal and Ethical Considerations: Ensure you have the right to download and use the Loom videos. This package does not enforce access controls or address legal concerns related to video downloading. Always respect copyright and privacy rights.

🧪 Testing

Run the tests with:

composer test

📄 License

This package is open-source software licensed under the MIT license.

For more detailed information or to report issues, please visit our GitHub repository.

ianfortier/loom-downloader 适用场景与选型建议

ianfortier/loom-downloader 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 145 次下载、GitHub Stars 达 2, 最近一次更新时间为 2024 年 10 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「video」 「laravel」 「download」 「loom」 「ianfortier」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 ianfortier/loom-downloader 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 ianfortier/loom-downloader 我们能提供哪些服务?
定制开发 / 二次开发

基于 ianfortier/loom-downloader 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 145
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 30
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-12