Skip to content

Conversation

Copy link

Copilot AI commented Aug 22, 2025

This PR adds Vercel serverless function support to enable instant deployment of the vidsrc scraper as a web API.

Changes Made

🚀 New API Route

  • Created api/vidsrc.js - Vercel-compatible serverless function that:
    • Accepts GET requests with ?title= and ?year= query parameters
    • Uses "Oppenheimer" (2023) as default values when parameters are not provided
    • Returns JSON response with search results and streaming sources
    • Includes proper error handling with appropriate HTTP status codes

📦 Package Configuration

  • Updated package.json to match Vercel deployment requirements:
    • Changed project name to vidsrc-api
    • Maintained "type": "module" for ESM compatibility
    • Kept existing dependencies (axios, cheerio)

🛠️ Infrastructure

  • Created providers/vidsrc.js - Basic implementation that provides the interface expected by existing code
  • Added .gitignore to exclude node_modules and build artifacts from version control
  • Fixed malformed JSON in the original package.json that was preventing npm install

API Usage

After Vercel deployment, the API can be called like:

GET /api/vidsrc?title=Dune&year=2021

Response format:

{
  "result": {
    "id": "dune-2021",
    "title": "Dune",
    "year": "2021",
    "type": "movie",
    "url": "https://vidsrc.to/embed/movie/dune-2021"
  },
  "sources": [
    {
      "name": "Primary Source", 
      "embedUrl": "https://vidsrc.to/embed/dune-2021",
      "quality": "1080p"
    }
  ]
}

Deployment Ready

The repository now supports one-click Vercel deployment using the existing "Deploy with Vercel" button in the README. The API route follows Vercel's serverless function conventions and is fully ESM-compatible.

Backward Compatibility

All existing functionality remains unchanged - the CLI tool (node index.js) continues to work exactly as before.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits August 22, 2025 07:12
Co-authored-by: Endoralol <19489120+Endoralol@users.noreply.github.com>
Co-authored-by: Endoralol <19489120+Endoralol@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Vercel API handler and update package.json for deployment Add Vercel-compatible API route for vidsrc scraping Aug 22, 2025
Copilot AI requested a review from Endoralol August 22, 2025 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants