File size: 9,434 Bytes
b6bffa4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
<!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>