amrashour3333 commited on
Commit
3f13a12
·
verified ·
1 Parent(s): c92df18

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +6 -4
  2. index.html +647 -19
  3. prompts.txt +1 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Webscrap
3
- emoji: 📉
4
  colorFrom: purple
5
- colorTo: yellow
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: webscrap
3
+ emoji: 🐳
4
  colorFrom: purple
5
+ colorTo: red
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,647 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>WebScraper Pro - Chrome Extension</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ /* Custom scrollbar */
11
+ ::-webkit-scrollbar {
12
+ width: 8px;
13
+ }
14
+ ::-webkit-scrollbar-track {
15
+ background: #f1f1f1;
16
+ }
17
+ ::-webkit-scrollbar-thumb {
18
+ background: #888;
19
+ border-radius: 4px;
20
+ }
21
+ ::-webkit-scrollbar-thumb:hover {
22
+ background: #555;
23
+ }
24
+
25
+ /* Animation for loading */
26
+ @keyframes pulse {
27
+ 0%, 100% {
28
+ opacity: 1;
29
+ }
30
+ 50% {
31
+ opacity: 0.5;
32
+ }
33
+ }
34
+
35
+ .animate-pulse {
36
+ animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
37
+ }
38
+
39
+ /* Custom switch toggle */
40
+ .switch {
41
+ position: relative;
42
+ display: inline-block;
43
+ width: 50px;
44
+ height: 24px;
45
+ }
46
+
47
+ .switch input {
48
+ opacity: 0;
49
+ width: 0;
50
+ height: 0;
51
+ }
52
+
53
+ .slider {
54
+ position: absolute;
55
+ cursor: pointer;
56
+ top: 0;
57
+ left: 0;
58
+ right: 0;
59
+ bottom: 0;
60
+ background-color: #ccc;
61
+ transition: .4s;
62
+ border-radius: 24px;
63
+ }
64
+
65
+ .slider:before {
66
+ position: absolute;
67
+ content: "";
68
+ height: 16px;
69
+ width: 16px;
70
+ left: 4px;
71
+ bottom: 4px;
72
+ background-color: white;
73
+ transition: .4s;
74
+ border-radius: 50%;
75
+ }
76
+
77
+ input:checked + .slider {
78
+ background-color: #3b82f6;
79
+ }
80
+
81
+ input:checked + .slider:before {
82
+ transform: translateX(26px);
83
+ }
84
+ </style>
85
+ </head>
86
+ <body class="bg-gray-100 min-h-screen">
87
+ <div class="container mx-auto px-4 py-8 max-w-6xl">
88
+ <!-- Header -->
89
+ <header class="bg-gradient-to-r from-blue-600 to-indigo-800 rounded-xl shadow-lg p-6 mb-8 text-white">
90
+ <div class="flex flex-col md:flex-row justify-between items-center">
91
+ <div class="flex items-center mb-4 md:mb-0">
92
+ <i class="fas fa-spider text-3xl mr-3"></i>
93
+ <h1 class="text-3xl font-bold">WebScraper Pro</h1>
94
+ </div>
95
+ <div class="flex space-x-4">
96
+ <button id="startScraping" class="bg-white text-blue-600 hover:bg-blue-50 px-4 py-2 rounded-lg font-semibold flex items-center">
97
+ <i class="fas fa-play mr-2"></i> Start Scraping
98
+ </button>
99
+ <button id="stopScraping" class="bg-red-500 hover:bg-red-600 text-white px-4 py-2 rounded-lg font-semibold flex items-center">
100
+ <i class="fas fa-stop mr-2"></i> Stop
101
+ </button>
102
+ </div>
103
+ </div>
104
+ <p class="mt-4 text-blue-100">Advanced web scraping tool with AI integration and comprehensive data collection</p>
105
+ </header>
106
+
107
+ <!-- Main Content -->
108
+ <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
109
+ <!-- Left Sidebar - Configuration -->
110
+ <div class="lg:col-span-1 bg-white rounded-xl shadow-md p-6">
111
+ <h2 class="text-xl font-bold mb-4 text-gray-800 border-b pb-2 flex items-center">
112
+ <i class="fas fa-cog mr-2 text-blue-500"></i> Configuration
113
+ </h2>
114
+
115
+ <!-- Scraping Options -->
116
+ <div class="mb-6">
117
+ <h3 class="font-semibold mb-2 text-gray-700 flex items-center">
118
+ <i class="fas fa-check-circle mr-2 text-green-500"></i> Data to Collect
119
+ </h3>
120
+ <div class="space-y-2">
121
+ <div class="flex items-center">
122
+ <input type="checkbox" id="collectText" class="mr-2" checked>
123
+ <label for="collectText">All Text Content</label>
124
+ </div>
125
+ <div class="flex items-center">
126
+ <input type="checkbox" id="collectLinks" class="mr-2" checked>
127
+ <label for="collectLinks">Links (a tags)</label>
128
+ </div>
129
+ <div class="flex items-center">
130
+ <input type="checkbox" id="collectImages" class="mr-2" checked>
131
+ <label for="collectImages">Images</label>
132
+ </div>
133
+ <div class="flex items-center">
134
+ <input type="checkbox" id="collectTables" class="mr-2" checked>
135
+ <label for="collectTables">Tables</label>
136
+ </div>
137
+ <div class="flex items-center">
138
+ <input type="checkbox" id="collectMeta" class="mr-2" checked>
139
+ <label for="collectMeta">Meta Tags</label>
140
+ </div>
141
+ <div class="flex items-center">
142
+ <input type="checkbox" id="collectForms" class="mr-2" checked>
143
+ <label for="collectForms">Forms</label>
144
+ </div>
145
+ </div>
146
+ </div>
147
+
148
+ <!-- Advanced Options -->
149
+ <div class="mb-6">
150
+ <h3 class="font-semibold mb-2 text-gray-700 flex items-center">
151
+ <i class="fas fa-sliders-h mr-2 text-purple-500"></i> Advanced Options
152
+ </h3>
153
+ <div class="space-y-3">
154
+ <div>
155
+ <label for="depth" class="block text-sm font-medium text-gray-700 mb-1">Scraping Depth</label>
156
+ <select id="depth" class="w-full p-2 border rounded-lg">
157
+ <option value="1">Current Page Only</option>
158
+ <option value="2">1 Level Deep</option>
159
+ <option value="3">2 Levels Deep</option>
160
+ <option value="0">All Links (Careful!)</option>
161
+ </select>
162
+ </div>
163
+ <div>
164
+ <label for="delay" class="block text-sm font-medium text-gray-700 mb-1">Delay Between Requests (ms)</label>
165
+ <input type="number" id="delay" value="1000" min="0" class="w-full p-2 border rounded-lg">
166
+ </div>
167
+ <div class="flex items-center justify-between">
168
+ <label for="headless" class="text-sm font-medium text-gray-700">Headless Mode</label>
169
+ <label class="switch">
170
+ <input type="checkbox" id="headless">
171
+ <span class="slider"></span>
172
+ </label>
173
+ </div>
174
+ </div>
175
+ </div>
176
+
177
+ <!-- Export Options -->
178
+ <div>
179
+ <h3 class="font-semibold mb-2 text-gray-700 flex items-center">
180
+ <i class="fas fa-file-export mr-2 text-yellow-500"></i> Export Options
181
+ </h3>
182
+ <div class="flex space-x-2">
183
+ <button id="exportJSON" class="bg-gray-200 hover:bg-gray-300 px-3 py-1 rounded-lg text-sm flex items-center">
184
+ <i class="fas fa-file-code mr-1"></i> JSON
185
+ </button>
186
+ <button id="exportCSV" class="bg-gray-200 hover:bg-gray-300 px-3 py-1 rounded-lg text-sm flex items-center">
187
+ <i class="fas fa-file-csv mr-1"></i> CSV
188
+ </button>
189
+ <button id="exportExcel" class="bg-gray-200 hover:bg-gray-300 px-3 py-1 rounded-lg text-sm flex items-center">
190
+ <i class="fas fa-file-excel mr-1"></i> Excel
191
+ </button>
192
+ </div>
193
+ </div>
194
+ </div>
195
+
196
+ <!-- Main Panel - Results and AI -->
197
+ <div class="lg:col-span-2 space-y-6">
198
+ <!-- Search Panel -->
199
+ <div class="bg-white rounded-xl shadow-md p-6">
200
+ <h2 class="text-xl font-bold mb-4 text-gray-800 border-b pb-2 flex items-center">
201
+ <i class="fas fa-search mr-2 text-green-500"></i> Web Search
202
+ </h2>
203
+ <div class="flex">
204
+ <input type="text" id="searchQuery" placeholder="Enter your search query..." class="flex-grow p-3 border rounded-l-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
205
+ <select id="searchEngine" class="border-t border-b border-r p-3 rounded-r-lg bg-gray-50">
206
+ <option value="google">Google</option>
207
+ <option value="bing">Bing</option>
208
+ <option value="duckduckgo">DuckDuckGo</option>
209
+ <option value="youtube">YouTube</option>
210
+ </select>
211
+ <button id="performSearch" class="ml-2 bg-blue-600 hover:bg-blue-700 text-white px-4 py-3 rounded-lg font-semibold">
212
+ <i class="fas fa-search mr-1"></i> Search
213
+ </button>
214
+ </div>
215
+ <div id="searchResults" class="mt-4 hidden">
216
+ <h3 class="font-semibold mb-2">Search Results</h3>
217
+ <div class="border rounded-lg p-3 max-h-60 overflow-y-auto">
218
+ <div class="text-center py-4 text-gray-500">
219
+ <i class="fas fa-spinner fa-spin mr-2"></i> Loading results...
220
+ </div>
221
+ </div>
222
+ </div>
223
+ </div>
224
+
225
+ <!-- AI Integration Panel -->
226
+ <div class="bg-white rounded-xl shadow-md p-6">
227
+ <h2 class="text-xl font-bold mb-4 text-gray-800 border-b pb-2 flex items-center">
228
+ <i class="fas fa-robot mr-2 text-purple-500"></i> AI Analysis
229
+ </h2>
230
+ <div class="mb-4">
231
+ <label for="aiModel" class="block text-sm font-medium text-gray-700 mb-1">AI Model</label>
232
+ <select id="aiModel" class="w-full p-2 border rounded-lg">
233
+ <option value="gpt-4">GPT-4</option>
234
+ <option value="gpt-3.5">GPT-3.5</option>
235
+ <option value="claude">Claude</option>
236
+ <option value="bard">Bard</option>
237
+ <option value="llama">Llama 2</option>
238
+ </select>
239
+ </div>
240
+ <div class="mb-4">
241
+ <label for="apiKey" class="block text-sm font-medium text-gray-700 mb-1">API Key</label>
242
+ <div class="flex">
243
+ <input type="password" id="apiKey" placeholder="Enter your API key" class="flex-grow p-2 border rounded-l-lg">
244
+ <button id="toggleKeyVisibility" class="bg-gray-200 hover:bg-gray-300 px-3 border-t border-b border-r rounded-r-lg">
245
+ <i class="fas fa-eye"></i>
246
+ </button>
247
+ </div>
248
+ </div>
249
+ <div class="mb-4">
250
+ <label for="aiPrompt" class="block text-sm font-medium text-gray-700 mb-1">Prompt</label>
251
+ <textarea id="aiPrompt" rows="3" class="w-full p-2 border rounded-lg" placeholder="What would you like the AI to analyze?"></textarea>
252
+ </div>
253
+ <div class="flex justify-between">
254
+ <button id="analyzeData" class="bg-purple-600 hover:bg-purple-700 text-white px-4 py-2 rounded-lg font-semibold flex items-center">
255
+ <i class="fas fa-brain mr-2"></i> Analyze Data
256
+ </button>
257
+ <button id="clearAnalysis" class="bg-gray-200 hover:bg-gray-300 px-4 py-2 rounded-lg font-semibold">
258
+ Clear
259
+ </button>
260
+ </div>
261
+ <div id="aiResponse" class="mt-4 hidden">
262
+ <h3 class="font-semibold mb-2">AI Response</h3>
263
+ <div class="border rounded-lg p-3 bg-gray-50 min-h-32 max-h-64 overflow-y-auto">
264
+ <div class="text-center py-4 text-gray-500">
265
+ <i class="fas fa-comment-dots"></i> AI response will appear here
266
+ </div>
267
+ </div>
268
+ </div>
269
+ </div>
270
+
271
+ <!-- Results Panel -->
272
+ <div class="bg-white rounded-xl shadow-md p-6">
273
+ <h2 class="text-xl font-bold mb-4 text-gray-800 border-b pb-2 flex items-center">
274
+ <i class="fas fa-database mr-2 text-blue-500"></i> Scraping Results
275
+ </h2>
276
+ <div class="flex justify-between items-center mb-4">
277
+ <div class="text-sm text-gray-600">
278
+ <span id="resultCount">0</span> items collected
279
+ </div>
280
+ <div class="flex space-x-2">
281
+ <button id="clearResults" class="bg-gray-200 hover:bg-gray-300 px-3 py-1 rounded-lg text-sm">
282
+ Clear Results
283
+ </button>
284
+ <button id="filterResults" class="bg-gray-200 hover:bg-gray-300 px-3 py-1 rounded-lg text-sm flex items-center">
285
+ <i class="fas fa-filter mr-1"></i> Filter
286
+ </button>
287
+ </div>
288
+ </div>
289
+ <div id="scrapingResults" class="border rounded-lg overflow-hidden">
290
+ <div class="overflow-x-auto">
291
+ <table class="min-w-full divide-y divide-gray-200">
292
+ <thead class="bg-gray-50">
293
+ <tr>
294
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Type</th>
295
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Content</th>
296
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Source</th>
297
+ </tr>
298
+ </thead>
299
+ <tbody id="resultsTableBody" class="bg-white divide-y divide-gray-200">
300
+ <tr>
301
+ <td colspan="3" class="px-6 py-4 text-center text-gray-500">
302
+ No data collected yet. Start scraping to see results.
303
+ </td>
304
+ </tr>
305
+ </tbody>
306
+ </table>
307
+ </div>
308
+ </div>
309
+ <div id="loadingIndicator" class="mt-4 hidden text-center">
310
+ <div class="inline-flex items-center px-4 py-2 bg-blue-100 text-blue-700 rounded-lg">
311
+ <i class="fas fa-spinner fa-spin mr-2"></i> Scraping in progress...
312
+ </div>
313
+ </div>
314
+ </div>
315
+ </div>
316
+ </div>
317
+
318
+ <!-- Footer -->
319
+ <footer class="mt-8 text-center text-gray-600 text-sm">
320
+ <p>WebScraper Pro Chrome Extension - Collect and analyze web data with AI</p>
321
+ <p class="mt-1">Version 1.0.0 | <a href="#" class="text-blue-600 hover:underline">Documentation</a> | <a href="#" class="text-blue-600 hover:underline">Support</a></p>
322
+ </footer>
323
+ </div>
324
+
325
+ <script>
326
+ // DOM Elements
327
+ const startScrapingBtn = document.getElementById('startScraping');
328
+ const stopScrapingBtn = document.getElementById('stopScraping');
329
+ const searchQueryInput = document.getElementById('searchQuery');
330
+ const searchEngineSelect = document.getElementById('searchEngine');
331
+ const performSearchBtn = document.getElementById('performSearch');
332
+ const searchResultsDiv = document.getElementById('searchResults');
333
+ const aiModelSelect = document.getElementById('aiModel');
334
+ const apiKeyInput = document.getElementById('apiKey');
335
+ const toggleKeyVisibilityBtn = document.getElementById('toggleKeyVisibility');
336
+ const aiPromptTextarea = document.getElementById('aiPrompt');
337
+ const analyzeDataBtn = document.getElementById('analyzeData');
338
+ const clearAnalysisBtn = document.getElementById('clearAnalysis');
339
+ const aiResponseDiv = document.getElementById('aiResponse');
340
+ const resultCountSpan = document.getElementById('resultCount');
341
+ const clearResultsBtn = document.getElementById('clearResults');
342
+ const filterResultsBtn = document.getElementById('filterResults');
343
+ const resultsTableBody = document.getElementById('resultsTableBody');
344
+ const loadingIndicator = document.getElementById('loadingIndicator');
345
+ const exportJSONBtn = document.getElementById('exportJSON');
346
+ const exportCSVBtn = document.getElementById('exportCSV');
347
+ const exportExcelBtn = document.getElementById('exportExcel');
348
+
349
+ // Sample data for demonstration
350
+ let scrapedData = [];
351
+ let searchResults = [];
352
+ let aiResponses = [];
353
+
354
+ // Event Listeners
355
+ startScrapingBtn.addEventListener('click', startScraping);
356
+ stopScrapingBtn.addEventListener('click', stopScraping);
357
+ performSearchBtn.addEventListener('click', performSearch);
358
+ toggleKeyVisibilityBtn.addEventListener('click', toggleKeyVisibility);
359
+ analyzeDataBtn.addEventListener('click', analyzeData);
360
+ clearAnalysisBtn.addEventListener('click', clearAnalysis);
361
+ clearResultsBtn.addEventListener('click', clearResults);
362
+ filterResultsBtn.addEventListener('click', filterResults);
363
+ exportJSONBtn.addEventListener('click', exportToJSON);
364
+ exportCSVBtn.addEventListener('click', exportToCSV);
365
+ exportExcelBtn.addEventListener('click', exportToExcel);
366
+
367
+ // Functions
368
+ function startScraping() {
369
+ loadingIndicator.classList.remove('hidden');
370
+ startScrapingBtn.disabled = true;
371
+ stopScrapingBtn.disabled = false;
372
+
373
+ // Simulate scraping process
374
+ setTimeout(() => {
375
+ // Generate sample data
376
+ scrapedData = generateSampleData();
377
+ updateResultsTable();
378
+ loadingIndicator.classList.add('hidden');
379
+ startScrapingBtn.disabled = false;
380
+ }, 3000);
381
+ }
382
+
383
+ function stopScraping() {
384
+ loadingIndicator.classList.add('hidden');
385
+ startScrapingBtn.disabled = false;
386
+ stopScrapingBtn.disabled = true;
387
+
388
+ // In a real extension, this would stop the scraping process
389
+ console.log("Scraping stopped");
390
+ }
391
+
392
+ function performSearch() {
393
+ const query = searchQueryInput.value.trim();
394
+ const engine = searchEngineSelect.value;
395
+
396
+ if (!query) {
397
+ alert("Please enter a search query");
398
+ return;
399
+ }
400
+
401
+ searchResultsDiv.classList.remove('hidden');
402
+ const resultsContainer = searchResultsDiv.querySelector('div > div');
403
+ resultsContainer.innerHTML = '<div class="text-center py-4 text-gray-500"><i class="fas fa-spinner fa-spin mr-2"></i> Searching ' + engine + ' for: ' + query + '</div>';
404
+
405
+ // Simulate search results
406
+ setTimeout(() => {
407
+ searchResults = generateSearchResults(query, engine);
408
+ displaySearchResults();
409
+ }, 1500);
410
+ }
411
+
412
+ function displaySearchResults() {
413
+ const resultsContainer = searchResultsDiv.querySelector('div > div');
414
+ resultsContainer.innerHTML = '';
415
+
416
+ if (searchResults.length === 0) {
417
+ resultsContainer.innerHTML = '<div class="text-center py-4 text-gray-500">No results found</div>';
418
+ return;
419
+ }
420
+
421
+ searchResults.forEach(result => {
422
+ const resultDiv = document.createElement('div');
423
+ resultDiv.className = 'mb-3 pb-3 border-b last:border-b-0';
424
+ resultDiv.innerHTML = `
425
+ <h4 class="font-medium text-blue-600 hover:underline cursor-pointer">${result.title}</h4>
426
+ <p class="text-sm text-gray-600">${result.url}</p>
427
+ <p class="text-sm mt-1 text-gray-700">${result.snippet}</p>
428
+ `;
429
+ resultsContainer.appendChild(resultDiv);
430
+ });
431
+ }
432
+
433
+ function toggleKeyVisibility() {
434
+ const icon = toggleKeyVisibilityBtn.querySelector('i');
435
+ if (apiKeyInput.type === 'password') {
436
+ apiKeyInput.type = 'text';
437
+ icon.classList.remove('fa-eye');
438
+ icon.classList.add('fa-eye-slash');
439
+ } else {
440
+ apiKeyInput.type = 'password';
441
+ icon.classList.remove('fa-eye-slash');
442
+ icon.classList.add('fa-eye');
443
+ }
444
+ }
445
+
446
+ function analyzeData() {
447
+ const apiKey = apiKeyInput.value.trim();
448
+ const model = aiModelSelect.value;
449
+ const prompt = aiPromptTextarea.value.trim();
450
+
451
+ if (!apiKey) {
452
+ alert("Please enter your API key");
453
+ return;
454
+ }
455
+
456
+ if (!prompt) {
457
+ alert("Please enter a prompt for the AI");
458
+ return;
459
+ }
460
+
461
+ aiResponseDiv.classList.remove('hidden');
462
+ const responseContainer = aiResponseDiv.querySelector('div > div');
463
+ responseContainer.innerHTML = '<div class="text-center py-4 text-gray-500"><i class="fas fa-spinner fa-spin mr-2"></i> Analyzing with ' + model + '...</div>';
464
+
465
+ // Simulate AI response
466
+ setTimeout(() => {
467
+ const aiResponse = generateAIResponse(prompt, model);
468
+ aiResponses.push(aiResponse);
469
+
470
+ responseContainer.innerHTML = `
471
+ <div class="mb-2">
472
+ <span class="bg-blue-100 text-blue-800 text-xs font-medium px-2.5 py-0.5 rounded">${model}</span>
473
+ </div>
474
+ <div class="prose max-w-none">
475
+ ${aiResponse}
476
+ </div>
477
+ `;
478
+ }, 2500);
479
+ }
480
+
481
+ function clearAnalysis() {
482
+ aiPromptTextarea.value = '';
483
+ aiResponseDiv.classList.add('hidden');
484
+ }
485
+
486
+ function clearResults() {
487
+ scrapedData = [];
488
+ updateResultsTable();
489
+ }
490
+
491
+ function filterResults() {
492
+ // In a real implementation, this would filter the results
493
+ alert("Filter functionality would be implemented here");
494
+ }
495
+
496
+ function updateResultsTable() {
497
+ resultCountSpan.textContent = scrapedData.length;
498
+
499
+ if (scrapedData.length === 0) {
500
+ resultsTableBody.innerHTML = `
501
+ <tr>
502
+ <td colspan="3" class="px-6 py-4 text-center text-gray-500">
503
+ No data collected yet. Start scraping to see results.
504
+ </td>
505
+ </tr>
506
+ `;
507
+ return;
508
+ }
509
+
510
+ resultsTableBody.innerHTML = '';
511
+
512
+ scrapedData.forEach(item => {
513
+ const row = document.createElement('tr');
514
+
515
+ // Truncate content for display
516
+ let displayContent = item.content;
517
+ if (displayContent.length > 100) {
518
+ displayContent = displayContent.substring(0, 100) + '...';
519
+ }
520
+
521
+ row.innerHTML = `
522
+ <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">${item.type}</td>
523
+ <td class="px-6 py-4 text-sm text-gray-500">${displayContent}</td>
524
+ <td class="px-6 py-4 text-sm text-gray-500">${item.source}</td>
525
+ `;
526
+
527
+ resultsTableBody.appendChild(row);
528
+ });
529
+ }
530
+
531
+ function exportToJSON() {
532
+ if (scrapedData.length === 0) {
533
+ alert("No data to export");
534
+ return;
535
+ }
536
+
537
+ const dataStr = JSON.stringify(scrapedData, null, 2);
538
+ downloadFile(dataStr, 'webscraper-data.json', 'application/json');
539
+ }
540
+
541
+ function exportToCSV() {
542
+ if (scrapedData.length === 0) {
543
+ alert("No data to export");
544
+ return;
545
+ }
546
+
547
+ // Simple CSV conversion
548
+ let csv = 'Type,Content,Source\n';
549
+ scrapedData.forEach(item => {
550
+ csv += `"${item.type}","${item.content.replace(/"/g, '""')}","${item.source}"\n`;
551
+ });
552
+
553
+ downloadFile(csv, 'webscraper-data.csv', 'text/csv');
554
+ }
555
+
556
+ function exportToExcel() {
557
+ alert("In a real implementation, this would export to Excel format");
558
+ }
559
+
560
+ function downloadFile(content, fileName, contentType) {
561
+ const blob = new Blob([content], { type: contentType });
562
+ const url = URL.createObjectURL(blob);
563
+
564
+ const a = document.createElement('a');
565
+ a.href = url;
566
+ a.download = fileName;
567
+ document.body.appendChild(a);
568
+ a.click();
569
+
570
+ setTimeout(() => {
571
+ document.body.removeChild(a);
572
+ URL.revokeObjectURL(url);
573
+ }, 100);
574
+ }
575
+
576
+ // Helper functions to generate sample data
577
+ function generateSampleData() {
578
+ const types = ['Text', 'Link', 'Image', 'Table', 'Meta Tag', 'Form'];
579
+ const sources = ['https://example.com', 'https://test.org', 'https://demo.net'];
580
+ const sampleTexts = [
581
+ 'This is some sample text content that would be scraped from a webpage.',
582
+ 'Another piece of content that might be interesting to collect.',
583
+ 'Web scraping involves extracting data from websites for analysis.',
584
+ 'Contact us for more information about our products and services.',
585
+ 'Copyright © 2023 Example Company. All rights reserved.'
586
+ ];
587
+
588
+ const data = [];
589
+ const itemCount = Math.floor(Math.random() * 15) + 5; // 5-20 items
590
+
591
+ for (let i = 0; i < itemCount; i++) {
592
+ const type = types[Math.floor(Math.random() * types.length)];
593
+ const source = sources[Math.floor(Math.random() * sources.length)];
594
+ let content = '';
595
+
596
+ if (type === 'Link') {
597
+ content = `<a href="${source}/page${i}">Link ${i}</a>`;
598
+ } else if (type === 'Image') {
599
+ content = `<img src="${source}/image${i}.jpg" alt="Sample image">`;
600
+ } else if (type === 'Table') {
601
+ content = '<table><tr><th>Header</th></tr><tr><td>Data</td></tr></table>';
602
+ } else if (type === 'Meta Tag') {
603
+ content = `<meta name="description" content="${sampleTexts[Math.floor(Math.random() * sampleTexts.length)]}">`;
604
+ } else if (type === 'Form') {
605
+ content = '<form><input type="text" name="username"><button>Submit</button></form>';
606
+ } else {
607
+ content = sampleTexts[Math.floor(Math.random() * sampleTexts.length)];
608
+ }
609
+
610
+ data.push({
611
+ type,
612
+ content,
613
+ source
614
+ });
615
+ }
616
+
617
+ return data;
618
+ }
619
+
620
+ function generateSearchResults(query, engine) {
621
+ const results = [];
622
+ const resultCount = Math.floor(Math.random() * 5) + 3; // 3-7 results
623
+
624
+ for (let i = 1; i <= resultCount; i++) {
625
+ results.push({
626
+ title: `${query} result ${i} from ${engine}`,
627
+ url: `https://${engine}.com/search?q=${encodeURIComponent(query)}&result=${i}`,
628
+ snippet: `This is a sample snippet for result ${i} about ${query}. The ${engine} search engine found this relevant content.`
629
+ });
630
+ }
631
+
632
+ return results;
633
+ }
634
+
635
+ function generateAIResponse(prompt, model) {
636
+ const responses = [
637
+ `Based on the scraped data and your prompt "${prompt}", I've analyzed the content and found several key patterns. The data suggests that most content falls into categories of informational text, navigation links, and media elements. This is typical for modern websites.`,
638
+ `Analysis of "${prompt}" reveals that the scraped data contains structured information that could be valuable for your research. The ${model} model identifies semantic relationships between different content types.`,
639
+ `The prompt "${prompt}" aligns well with the collected data. My analysis shows that 78% of content is textual, 15% is navigational, and 7% is media. This distribution suggests an information-rich website.`,
640
+ `Using ${model}, I've processed your request about "${prompt}". The results indicate strong thematic consistency across the scraped pages, with recurring topics and a clear information hierarchy.`
641
+ ];
642
+
643
+ return responses[Math.floor(Math.random() * responses.length)];
644
+ }
645
+ </script>
646
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=amrashour3333/webscrap" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
647
+ </html>
prompts.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ هل يمكن ان تكتب لى برونت الى بناء اضافة الى جوجول كروم webscrap تقوم بحمع المعلمات من المواقع جميع المعلمات الممكنة من a to z وقم بأضافة ميزه البحث فى الانترنت وقم بأضافة ميزه ادخل api واستخدام النماذج الى العديد من النماذج الكبيره