0% found this document useful (0 votes)
8 views6 pages

Tiny Shortner Script

The document is an HTML code for a web application called 'Pro Shortner' that allows users to generate shortened URLs for YouTube redirects. It includes a form for inputting a long URL, checks if the URL contains specific numbers, and provides a shortened URL using the TinyURL API. Additionally, it features a button to copy the shortened URL to the clipboard.

Uploaded by

bestsellar999
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views6 pages

Tiny Shortner Script

The document is an HTML code for a web application called 'Pro Shortner' that allows users to generate shortened URLs for YouTube redirects. It includes a form for inputting a long URL, checks if the URL contains specific numbers, and provides a shortened URL using the TinyURL API. Additionally, it features a button to copy the shortened URL to the clipboard.

Uploaded by

bestsellar999
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 6

<!

DOCTYPE html>

<html>

<head>

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Pro Shortner</title>

<style>

body {

background-image: url("https://wallpapercave.com/wp/wp3471926.jpg");

background-repeat: no-repeat;

background-position: center;

background-size: 300%;

animation: slide-background 0.1s linear infinite;

h1 {

color: #bcff05; /* set the title color */

text-align: center;

margin-top: 50px;

font-size: 70px;

label {

color: #00f7ff; /* set the title color */

text-align: center;

margin-top: 50px;

font-size: 30px;

}
label {

display: block;

margin-bottom: 10px;

input[type="text"] {

width: 100%;

padding: 10px;

font-size: 16px;

border: 2px solid #2702f7;

border-radius: 10px;

box-sizing: border-box;

margin-bottom: 20px;

input[type="submit"] {

background-color: #1db122;

color: rgb(0, 9, 58);

padding: 10px 100px;

font-size: 30px;

font-style: initial;

border: none 10px;

border-radius: 20px;

cursor: pointer;
}

input[type="submit"]:hover {

background-color: #00ca0a;

button {

background-color: blue;

color: white;

padding: 10px 20px;

border: none;

border-radius: 5px;

cursor: pointer;

button:hover {

background-color: darkblue;

</style>

</head>

<body>

<h1>Pro Shortner</h1>

<form onsubmit="generateRedirectUrl(); return false;">

<label for="long-url">Enter URL:</label>

<input type="text" id="long-url" name="long-url" required>

<input type="submit" value="Genarate URL">

</form>
<p id="result"></p>

<button id="copy-btn">Copy to Clipboard</button>

<script>

function generateRedirectUrl() {

const longUrl = document.getElementById("long-url").value;

const numbersToCheck = ["191530", "184222", "174805", "184505", "178709", "188152", "189821"]; //


add the numbers to check here

if (!numbersToCheck.some(num => longUrl.includes(num))) {

alert("This URL does not shorten without registration. Please contact AMAN- +8801773633328
(WhatsApp) or shek_Mony- +8801716372108 (WhatsApp).");

return;

const event = "comments";

const redirToken =
"QUFFLUhqbUp5eU16YTBBOUpfZVBfYllYZTlHajlBX2RiUXxBQ3Jtc0ttVU5BZDk5NWhIczBhX0Vja0FkUm9w
UHJ0WUZfODhlMm12LXdUamt6Z2VMUVM0MlpqcVFuRE4wcTB5VVBOMnJSUHVGLWFtVHpyTHRzUnpR
UlFyOHFNR3BDRjBnYkZwXzhpTkJUdVkzcnN0YURlbVdZYw&q";

const redirectUrl = "https://www.youtube.com/redirect?q=" + encodeURIComponent(longUrl) +


"&event=" + event + "&redir_token=" + redirToken + "&html_redirect=1";

const tinyUrl = "https://tinyurl.com/api-create.php";

const urlParams = new URLSearchParams({

url: redirectUrl

});

const fullUrl = `${tinyUrl}?${urlParams}`;


fetch(fullUrl)

.then(response => response.text())

.then(data => {

const shortenedUrl = data;

console.log(shortenedUrl);

// Update result and copy button

const shortUrl = shortenedUrl;

document.getElementById("result").innerHTML = "Your shortened YouTube redirect URL is: <a href='"


+ shortUrl + "' target='_blank'>" + shortUrl + "</a>";

document.getElementById("copy-btn").style.display = "block";

document.getElementById("copy-btn").setAttribute("data-clipboard-text", shortUrl);

})

.catch(error => {

console.error(error);

document.getElementById("result").innerHTML = "An error occurred while shortening the URL.";

});

// Add copy to clipboard functionality

const copyBtn = document.getElementById("copy-btn");

copyBtn.addEventListener("click", function() {

const clipboardText = copyBtn.getAttribute("data-clipboard-text");

navigator.clipboard.writeText(clipboardText).then(function() {

alert("Copied to clipboard!");

}, function() {
alert("Error: Could not copy to clipboard.");

});

});

</script>

</body>

</html>

You might also like