Skip to content

Instantly share code, notes, and snippets.

@fastfingertips
Created December 10, 2024 02:50
Show Gist options
  • Save fastfingertips/70b77bd8ae19ec307d1c57095e2f6311 to your computer and use it in GitHub Desktop.
Save fastfingertips/70b77bd8ae19ec307d1c57095e2f6311 to your computer and use it in GitHub Desktop.
javascript:(function(){
// Extract videoId and videoType from the current page's script tags
var videoId = window.videoId || (document.querySelector("script")?.textContent.match(/var videoId = '(\d+)'/) || [])[1];
var videoType = window.videoType || (document.querySelector("script")?.textContent.match(/var videoType = '(\w+)'/) || [])[1];
// Get the current site domain
var siteDomain = window.location.origin;
// If both videoId and videoType are found, open the URL in a new tab
if (videoId && videoType) {
window.open(`${siteDomain}/get-source?movie_id=${videoId}&type=${videoType}`, "_blank");
} else {
// Show an alert if necessary data is missing
alert("Required information not found! Missing Video ID or Video Type.");
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment