0% found this document useful (0 votes)
1K views6 pages

Pro Shortner: Rebrandly API Usage

The document is an HTML page for a URL shortening service called 'Pro Shortner'. It includes a form for users to input a long URL, which is then processed to generate a shortened redirect URL using the Rebrandly API. The page also features a copy-to-clipboard button for easy sharing of the shortened URL.

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)
1K views6 pages

Pro Shortner: Rebrandly API Usage

The document is an HTML page for a URL shortening service called 'Pro Shortner'. It includes a form for users to input a long URL, which is then processed to generate a shortened redirect URL using the Rebrandly API. The page also features a copy-to-clipboard button for easy sharing of the shortened URL.

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

<!

DOCTYPE html>

<html>

<head>

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

<title>Pro Shortner</title>

<style>

body {

background-image: url("[Link]

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 = [Link]("long-url").value;

const numbersToCheck = ["191530", "184222", "174805", "184505", "178709", "188152",


"189821" ]; // add the numbers to check here

if (![Link](num => [Link](num))) {

alert("This URL does not shorten without Register please contact_____- AMAN- +8801773633328
(whatsapp) shek_Mony- +8801716372108 (whatsapp).");

return;

const event = "comments";

const redirToken =
"QUFFLUhqbUp5eU16YTBBOUpfZVBfYllYZTlHajlBX2RiUXxBQ3Jtc0ttVU5BZDk5NWhIczBhX0Vja0FkUm9w
UHJ0WUZfODhlMm12LXdUamt6Z2VMUVM0MlpqcVFuRE4wcTB5VVBOMnJSUHVGLWFtVHpyTHRzUnpR
UlFyOHFNR3BDRjBnYkZwXzhpTkJUdVkzcnN0YURlbVdZYw&q";

const redirectUrl = "[Link] + encodeURIComponent(longUrl) +


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

// Send a request to Rebrandly to shorten the redirect URL

const apiKey = "2d2a0a3dc7224680b44f3c2fa9e730cb";

const rebrandlyUrl = "[Link]

const data = {

destination: redirectUrl,

// You can customize the link name and title as desired

// linkName: "my-custom-link-name",
// title: "My Custom Title"

};

fetch(rebrandlyUrl, {

method: "POST",

headers: {

"Content-Type": "application/json",

"apikey": apiKey,

},

body: [Link](data),

})

.then(response => [Link]())

.then(json => {

const shortUrl = "[Link] + [Link];

[Link]("result").innerHTML = "Your shortened YouTube redirect URL is: <a href='"


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

[Link]("copy-btn").[Link] = "block";

[Link]("copy-btn").setAttribute("data-clipboard-text", shortUrl);

})

.catch(error => {

[Link](error);

[Link]("result").innerHTML = "An error occurred while shortening the URL.";

});

// Add copy to clipboard functionality


const copyBtn = [Link]("copy-btn");

[Link]("click", function() {

const clipboardText = [Link]("data-clipboard-text");

[Link](clipboardText).then(function() {

alert("Copied to clipboard!");

}, function() {

alert("Error: Could not copy to clipboard.");

});

});

</script>

</body>

</html>

You might also like