-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
214 lines (192 loc) · 8.36 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>OmniScrape: Multi-Website Search Tool | Uncoder.eu.org</title>
<meta name="description" content="OmniScrape by Uncoder.eu.org is a powerful multi-search website scraper. Search across multiple websites simultaneously for efficient content discovery." />
<meta name="keywords" content="OmniScrape, website scraper, multi-search tool, web search, content discovery, Uncoder.eu.org" />
<link rel="canonical" href="https://uncoder.eu.org/omniscrape/" />
<meta name="robots" content="index, follow" />
<meta name="author" content="OshekharO" />
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website" />
<meta property="og:url" content="https://uncoder.eu.org/omniscrape/" />
<meta property="og:title" content="OmniScrape: Multi-Website Search Tool" />
<meta property="og:description" content="Discover content across multiple websites simultaneously with OmniScrape, the powerful multi-search tool by Uncoder.eu.org." />
<meta property="og:image" content="https://uncoder.eu.org/images/omniscrape-og.jpg" />
<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:url" content="https://uncoder.eu.org/omniscrape/" />
<meta property="twitter:title" content="OmniScrape: Multi-Website Search Tool" />
<meta property="twitter:description" content="Discover content across multiple websites simultaneously with OmniScrape, the powerful multi-search tool by Uncoder.eu.org." />
<meta property="twitter:image" content="https://uncoder.eu.org/images/omniscrape-twitter.jpg" />
<meta name="copyright" content="Copyright © 2024 OshekharO" />
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" />
<style>
body {
font-family: Inter;
font-weight: 300;
font-size: 14px;
line-height: 1.6;
color: #616370;
background: #26272c;
height: 100%;
position: relative;
margin: 2.5rem;
}
.container {
max-width: 800px;
}
.alert {
background-color: #454d55;
border: none;
color: #fff;
}
.alert-success {
background-color: #28a745;
}
.alert-warning {
background-color: #ffc107;
color: #000;
}
.alert-danger {
background-color: #dc3545;
}
</style>
</head>
<body>
<div class="container mt-5">
<h1 class="fs-2 fw-bold mb-4 text-uppercase mx-auto text-center text-light">OmniScrape</h1>
<div class="row justify-content-center">
<div class="col-md-8">
<div class="mb-3">
<label for="categorySelect" class="form-label fs-7 font-monospace badge bg-danger text-light">Category</label>
<select id="categorySelect" class="form-select mb-3">
<option value="all">All Categories</option>
<!-- Categories will be dynamically added here -->
</select>
</div>
<div class="mb-3">
<label for="searchInput" class="form-label fs-7 font-monospace badge bg-danger text-light">Search Term</label>
<input type="text" class="form-control" id="searchInput" required />
</div>
<button id="searchButton" class="btn btn-primary mb-3">Search</button>
<div id="results" class="mt-4"></div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
<script>
let websites = {};
const corsBypassUrl = "https://cors-bypasser-gilt.vercel.app/fetchdata?url=";
$(document).ready(function () {
$.getJSON("sites.json", function (data) {
websites = data;
console.log("Websites data loaded successfully");
populateCategorySelect();
}).fail(function (jqxhr, textStatus, error) {
console.error("Error loading sites.json:", error);
});
$("#searchButton").click(function () {
const searchTerm = $("#searchInput").val().trim();
const category = $("#categorySelect").val();
if (searchTerm) {
searchWebsites(searchTerm, category);
}
});
});
function populateCategorySelect() {
const select = $("#categorySelect");
Object.keys(websites).forEach((category) => {
select.append(
$("<option>", {
value: category,
text: category.charAt(0).toUpperCase() + category.slice(1),
})
);
});
}
function searchWebsites(searchTerm, category) {
$("#results").empty();
const categoriesToSearch = category === "all" ? Object.keys(websites) : [category];
categoriesToSearch.forEach((cat) => {
Object.values(websites[cat]).forEach((website) => {
const searchUrl = website.url + encodeURIComponent(searchTerm);
const bypassUrl = corsBypassUrl + encodeURIComponent(searchUrl);
$.ajax({
url: bypassUrl,
method: "GET",
success: function (data) {
const results = parseResults(data, website);
displayResults(website.name, results);
},
error: function (xhr, status, error) {
console.error(`Error fetching data from ${website.name}:`, error);
displayResults(website.name, []);
},
});
});
});
}
function parseResults(html, website) {
const parser = new DOMParser();
const doc = parser.parseFromString(html, "text/html");
const results = [];
const items = doc.querySelectorAll(website.main);
items.forEach((item) => {
const titleElement = item.querySelector(website.title);
const imgElement = item.querySelector(website.img);
const hrefElement = item.querySelector(website.href);
if (titleElement && imgElement && hrefElement) {
let imgSrc = imgElement.getAttribute("src") || imgElement.getAttribute("data-src") || imgElement.getAttribute("data-original");
if (!imgSrc) {
console.warn("No image source found for:", titleElement.textContent.trim());
imgSrc = "path/to/default/image.jpg"; // Optional: set a default image
}
let href = hrefElement.getAttribute("href");
// Check if the href is a relative URL and prepend the base URL if necessary
if (href && !href.startsWith("http")) {
href = website.baseUrl + (href.startsWith("/") ? "" : "/") + href;
}
// Similarly, check if the image source is a relative URL
if (imgSrc && !imgSrc.startsWith("http")) {
imgSrc = website.baseUrl + (imgSrc.startsWith("/") ? "" : "/") + imgSrc;
}
results.push({
title: titleElement.textContent.trim(),
img: imgSrc,
href: href,
});
}
});
return results;
}
function displayResults(websiteName, results) {
const resultsContainer = $("#results");
const websiteResults = $(`<div class="mb-4"><h2 class="text-light">${websiteName}</h2></div>`);
if (results.length === 0) {
websiteResults.append('<p class="alert alert-warning">No results found.</p>');
} else {
const row = $('<div class="row"></div>');
results.forEach((result) => {
const col = $(`
<div class="col-md-4 mb-3">
<div class="card bg-dark text-light border-danger">
<img src="${result.img}" class="card-img-top" alt="${result.title}" loading="lazy">
<div class="card-body">
<h5 class="card-title">${result.title}</h5>
<a href="${result.href}" class="btn btn-primary" target="_blank">View</a>
</div>
</div>
</div>
`);
row.append(col);
});
websiteResults.append(row);
}
resultsContainer.append(websiteResults);
}
</script>
</body>
</html>