소셜 미디어 비디오 스트림 가로채기: 40줄 콘솔 스크립트
발행: (2026년 2월 2일 오전 05:35 GMT+9)
3 분 소요
원문: Dev.to
Source: Dev.to
작동 방식
fetch()와 XMLHttpRequest.open()을 재정의하여 외부 네트워크 요청을 가로챕니다. .mp4 URL을 발견하면 바이트‑범위 파라미터를 제거하고 정리된 URL을 로그에 남깁니다. getVideoUrls() 헬퍼를 사용하면 수집된 모든 URL을 가져올 수 있어 콘솔이 복잡해졌을 때 유용합니다.
// Instagram Story Video URL Extractor
(() => {
const videoUrls = new Set();
// Strip start and end time params
const cleanUrl = (url) => {
const u = new URL(url);
u.searchParams.delete('bytestart');
u.searchParams.delete('byteend');
return u.toString();
};
// Intercept fetch
const origFetch = window.fetch;
window.fetch = async function(url, ...args) {
const urlStr = url?.toString?.() || url;
// Domain and extension matcher, you can drop the domain to use this elsewhere
if (urlStr.includes('fbcdn.net') && urlStr.includes('.mp4')) {
const clean = cleanUrl(urlStr);
if (!videoUrls.has(clean)) {
videoUrls.add(clean);
console.log('> Video found:', clean);
}
}
return origFetch.apply(this, [url, ...args]);
};
// Intercept XHR
const origOpen = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function(method, url) {
// Domain and extension matcher, you can drop the domain to use this elsewhere
if (url?.includes?.('fbcdn.net') && url?.includes?.('.mp4')) {
const clean = cleanUrl(url);
if (!videoUrls.has(clean)) {
videoUrls.add(clean);
console.log('> Video found:', clean);
}
}
return origOpen.apply(this, arguments);
};
// Helper to get all collected URLs
window.getVideoUrls = () => {
const urls = [...videoUrls];
console.log(`\nFound ${urls.length} video(s):\n`);
urls.forEach((url, i) => console.log(`${i + 1}. ${url}\n`));
return urls;
};
console.log('Extractor active - play stories/reels, then run getVideoUrls()');
})();
Note: 이 스크립트는 연구 목적에만 사용됩니다. 소유하지 않은 콘텐츠를 다운로드하지 마세요.
사용 방법 (전혀 모르는 분들을 위해)
- DevTools를 엽니다 (F12 키).
- 스크립트를 콘솔에 붙여넣고 Enter 키를 누릅니다.
- 원하는 비디오를 재생합니다; URL이 콘솔에 표시됩니다.
- 필요에 따라
getVideoUrls()를 실행해 수집된 모든 URL을 확인합니다. - URL을 새 탭에서 열어 비디오를 보거나, 오른쪽 클릭 → 다른 이름으로 저장을 선택해 다운로드합니다.