Direct Download & Stream
Bypass virus scan • Works in any browser/player
No Virus Warning
Worker Proxy
Any Player
Worker Solution
This uses _worker.js to proxy Google Drive downloads, bypassing the "Can't scan for viruses" warning. Deploy to Cloudflare Pages for it to work.
Link Generator
Direct Download (No Virus Warning)
Stream Link (For Video Players)
Troubleshooting:
- Make sure
_worker.jsis deployed - File must be shared as "Anyone with the link"
- Wait 1-2 minutes after deploying
Quick Test
Test with a sample video file ID
Video Player
Required Files
Upload these files to your GitHub repo
video-player/
index.html (main page)
_worker.js (proxy - required!)
_worker.js (Copy This!)
export default {
async fetch(request, env, ctx) {
const url = new URL(request.url);
// Handle CORS
if (request.method === 'OPTIONS') {
return new Response(null, {
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, HEAD, OPTIONS',
'Access-Control-Allow-Headers': '*',
}
});
}
// Route: /download/:fileId
if (url.pathname.startsWith('/download/')) {
const fileId = url.pathname.replace('/download/', '').split('/')[0];
if (fileId) return handleDownload(fileId);
}
// Route: /stream/:fileId
if (url.pathname.startsWith('/stream/')) {
const fileId = url.pathname.replace('/stream/', '').split('/')[0];
if (fileId) return handleStream(fileId, request);
}
// Serve static files
return env.ASSETS.fetch(request);
}
};
async function handleDownload(fileId) {
try {
// Try direct download first
let response = await fetch(
`https://drive.google.com/uc?export=download&id=${fileId}`,
{
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/91.0'
},
redirect: 'follow'
}
);
const contentType = response.headers.get('content-type') || '';
// If HTML (virus warning), bypass it
if (contentType.includes('text/html')) {
const html = await response.text();
const confirmMatch = html.match(/confirm=([0-9A-Za-z_-]+)/);
if (confirmMatch) {
response = await fetch(
`https://drive.google.com/uc?export=download&id=${fileId}&confirm=${confirmMatch[1]}`,
{
headers: {
'User-Agent': 'Mozilla/5.0 Chrome/91.0',
'Cookie': response.headers.get('set-cookie') || ''
},
redirect: 'follow'
}
);
} else {
// Fallback: use confirm=t
response = await fetch(
`https://drive.google.com/uc?export=download&id=${fileId}&confirm=t`,
{ redirect: 'follow' }
);
}
}
// Get filename
let filename = 'download';
const disposition = response.headers.get('content-disposition');
if (disposition) {
const match = disposition.match(/filename\*?=['"]?(?:UTF-8'')?([^;\r\n"']+)/i);
if (match) filename = decodeURIComponent(match[1]);
}
return new Response(response.body, {
headers: {
'Content-Type': response.headers.get('content-type') || 'application/octet-stream',
'Content-Disposition': `attachment; filename="${filename}"`,
'Access-Control-Allow-Origin': '*',
}
});
} catch (error) {
return new Response(JSON.stringify({ error: error.message }), {
status: 500,
headers: { 'Content-Type': 'application/json' }
});
}
}
async function handleStream(fileId, request) {
try {
const response = await fetch(
`https://drive.google.com/uc?export=download&id=${fileId}&confirm=t`,
{
headers: {
'User-Agent': 'Mozilla/5.0 Chrome/91.0',
'Range': request.headers.get('Range') || ''
},
redirect: 'follow'
}
);
return new Response(response.body, {
status: response.status,
headers: {
'Content-Type': response.headers.get('content-type') || 'video/mp4',
'Content-Length': response.headers.get('content-length') || '',
'Accept-Ranges': 'bytes',
'Access-Control-Allow-Origin': '*',
}
});
} catch (error) {
return new Response(JSON.stringify({ error: error.message }), {
status: 500,
headers: { 'Content-Type': 'application/json' }
});
}
}
This file is REQUIRED for virus scan bypass! Without it, you'll get the warning.
1
2
Create Repository
Create new repo for your project
- Click + New Repository
- Name: video-player
- Set to Public
- Click Create Repository
3
Upload Files
Upload both required files
- Click Add file → Upload files
- Upload index.html
- Upload _worker.js
- Click Commit changes
Both files must be in the root folder (not in subfolders)
1
2
Create Pages Project
- Go to Workers & Pages
- Click Create Application
- Select Pages tab
- Click Connect to Git
3
Connect GitHub
- Select GitHub
- Authorize Cloudflare
- Select video-player repo
4
Build Settings
Leave these EMPTY for static HTML
Project name: video-player
Build command: (leave empty)
Output directory: (leave empty)
5
Deploy! 🚀
Click Save and Deploy
Your site will be live at:
https://video-player.pages.dev
No Virus Warning
Global CDN
Unlimited BW
Free SSL
How It Works
- User pastes Google Drive link
- Worker generates proxy URL: /download/FILE_ID
- Worker fetches file from Google Drive
- Worker bypasses virus scan warning
- User gets direct download - no warnings!
API Endpoints
# Download (triggers download)
https://your-site.pages.dev/download/FILE_ID
# Stream (for video players)
https://your-site.pages.dev/stream/FILE_ID