Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save shalakolee/8618eb479b5b01d89f18aab286acde20 to your computer and use it in GitHub Desktop.
Save shalakolee/8618eb479b5b01d89f18aab286acde20 to your computer and use it in GitHub Desktop.
(async () => {
// Find the current video ID from the URL
const match = window.location.pathname.match(/video\/([a-zA-Z0-9]+)/);
if (!match) {
console.log("Video ID not found in URL.");
return;
}
const videoId = match[1];
// Fetch the metadata endpoint
const metaUrl = `https://www.dailymotion.com/player/metadata/video/${videoId}`;
try {
const response = await fetch(metaUrl);
const data = await response.json();
if (
data &&
data.qualities &&
data.qualities.auto &&
data.qualities.auto[0] &&
data.qualities.auto[0].url
) {
console.log("Direct m3u8 link:", data.qualities.auto[0].url);
} else {
console.log("Direct m3u8 link not found in metadata.");
}
} catch (e) {
console.error("Failed to fetch metadata:", e);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment