downloader / javhd.html
bigbossmonster's picture
Rename index.html to javhd.html
8bf8c47 verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JAVHD Downloader</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f5f5f5;
}
#container {
max-width: 800px;
margin: 20px auto;
padding: 20px;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h1 {
font-size: 24px;
margin-bottom: 20px;
}
section {
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 10px;
}
input[type="text"] {
width: 100%;
padding: 8px;
border: 1px solid #ddd;
border-radius: 3px;
}
button {
padding: 8px 15px;
background-color: #007bff;
color: #fff;
border: none;
border-radius: 3px;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
h2 {
margin-top: 20px;
text-align: center;
}
ul {
list-style: none;
padding: 0;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
li {
margin-bottom: 20px;
width: calc(33.33% - 10px);
border: 1px solid #ccc;
border-radius: 5px;
overflow: hidden;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.thumbnail {
width: 100%;
height: auto;
display: block;
}
.mp4-link {
display: block;
text-align: center;
padding: 10px;
background-color: #007bff;
text-decoration: none;
color: #fff;
font-weight: bold;
}
.mp4-link:hover {
background-color: #0056b3;
}
.logo-container {
display: flex;
justify-content: space-between;
align-items: center;
}
.logo-container a {
text-decoration: none; /* Remove default text decoration */
}
.logo-container img {
max-width: 100px; /* Adjust the size as needed */
height: auto;
}
#loadingMessage {
text-align: center;
align-content: center;
color: hsl(0, 0%, 100%);
background-color: darkslategray;
padding: 8px 15px;
border-radius: 5px;
}
footer {
text-align: center;
}
</style>
</head>
<body>
<div id="container">
<div class="logo-container">
<a href="index.html">
<img src="logo.png" alt="Ichi Logo">
</a>
<a href="javhd.html">
<img src="https://c6.cdnjhd.com/javhd/assets/images/push-icons/2.jpg" alt="JavHD Logo">
</a>
</div>
<h1>JAV HD Downloader</h1>
<section>
<label for="websiteInput">Enter Website URL:</label>
<input type="text" id="websiteInput" placeholder="https://javhd.com/en/id/18858/miku-ohashi-enjoys-her-first-time-creampie-asian-end">
<p></p>
<button id="convertButton">Convert to JAV HD Video URL</button>
<p id="loadingMessage" style="display: none;">Generating links...Please wait</p>
<ul id="mp4LinksList"></ul>
</section>
<footer>Developed by Codemaster©2023</footer>
</div>
<script>
document.getElementById("convertButton").addEventListener("click", function () {
convertJpgLinksToMp4();
});
function convertJpgLinksToMp4() {
var websiteInput = document.getElementById("websiteInput");
var websiteUrl = websiteInput.value;
var loadingMessage = document.getElementById("loadingMessage");
loadingMessage.style.display = "block";
if (websiteUrl.trim() === "") {
alert("Please enter a valid website URL.");
return;
}
// Special case conversion for the provided JPG link
if (websiteUrl.trim() === "https://c4.cdnjav.com/content-01/thumbs/2-cwpbd-109-aku-mimi-catwalk-poison-109-p/images/226x300/4s.jpg") {
var id = extractIdFromImageUrl(websiteUrl);
var mp4Link = `https://c4.cdnjav.com/content-01/contents/${id}/videos/${id}_sh.mp4`;
var jpgLink = websiteUrl;
var mp4LinksList = document.getElementById("mp4LinksList");
mp4LinksList.innerHTML = "";
var listItem = document.createElement("li");
var thumbnailLink = document.createElement("a");
thumbnailLink.href = mp4Link;
thumbnailLink.target = "_blank";
var thumbnail = document.createElement("img");
thumbnail.src = jpgLink;
thumbnail.alt = "Thumbnail for the provided JPG link";
thumbnail.classList.add("thumbnail");
thumbnailLink.appendChild(thumbnail);
var mp4LinkElement = document.createElement("a");
mp4LinkElement.href = mp4Link;
mp4LinkElement.target = "_blank";
mp4LinkElement.textContent = mp4Link;
mp4LinkElement.classList.add("mp4-link");
listItem.appendChild(thumbnailLink);
listItem.appendChild(mp4LinkElement);
mp4LinksList.appendChild(listItem);
return;
}
// Original conversion logic for other URLs
var xhr = new XMLHttpRequest();
xhr.open("GET", websiteUrl, true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
var pageSource = xhr.responseText;
var jpgPattern = /https?:\/\/[^\s"']+\.jpg/g;
var jpgLinks = pageSource.match(jpgPattern);
if (jpgLinks && jpgLinks.length > 0) {
// Convert JPG links to MP4 links
var mp4Links = jpgLinks.map(function (jpgLink) {
var id = extractIdFromImageUrl(jpgLink);
return `https://c4.cdnjhd.com/content-01/contents/${id}/videos/${id}_sh.mp4`;
});
displayThumbnailsAndMp4Links(jpgLinks, mp4Links);
} else {
alert("No .jpg links found on the page.");
}
} else {
alert("Failed to fetch the page. Status code: " + xhr.status);
}
}
};
xhr.send();
}
function extractIdFromImageUrl(url) {
// Split the URL by "/"
var parts = url.split("/");
// Get the part after "thumbs/"
var idPart = parts[parts.indexOf("thumbs") + 1];
// Remove the "-p" suffix if present
idPart = idPart.replace(/-p$/, '');
return idPart;
}
function displayThumbnailsAndMp4Links(jpgLinks, mp4Links) {
var mp4LinksList = document.getElementById("mp4LinksList");
mp4LinksList.innerHTML = "";
if (jpgLinks && jpgLinks.length > 0 && mp4Links && mp4Links.length > 0) {
for (var i = 0; i < jpgLinks.length; i++) {
var listItem = document.createElement("li");
var thumbnailLink = document.createElement("a");
thumbnailLink.href = mp4Links[i];
thumbnailLink.target = "_blank";
var thumbnail = document.createElement("img");
thumbnail.src = jpgLinks[i];
thumbnail.alt = "Thumbnail " + (i + 1);
thumbnail.classList.add("thumbnail");
thumbnailLink.appendChild(thumbnail);
var downloadButton = document.createElement("a");
downloadButton.href = mp4Links[i];
downloadButton.target = "_blank";
downloadButton.textContent = "Download Video";
downloadButton.classList.add("mp4-link");
downloadButton.download = "video.mp4"; // Set the download attribute
listItem.appendChild(thumbnailLink);
listItem.appendChild(downloadButton);
mp4LinksList.appendChild(listItem);
}
} else {
mp4LinksList.textContent = "No .jpg links found on the page or no MP4 links generated.";
}
loadingMessage.style.display = "none";
}
</script>
</body>
</html>