Size
2.9 KB
Version
1.1.8
Created
Oct 27, 2025
Updated
about 2 months ago
1// ==UserScript==
2// @name IMVU Username Parser
3// @description Parse and extract usernames from IMVU People search results
4// @version 1.1.8
5// @match https://*.imvu.com/*
6// @icon https://www.imvu.com/common/withme/img/favicon/favicon.ico
7// @grant GM.getValue
8// @grant GM.setValue
9// @grant GM.listValues
10// ==/UserScript==
11(function() {
12 'use strict';
13
14 async function saveAlertToDatabase(username) {
15 // Get existing alerts from database
16 const existingAlerts = await GM.getValue('username_alerts', '[]');
17 const alerts = JSON.parse(existingAlerts);
18
19 // Create new alert entry
20 const alertEntry = {
21 username: username,
22 timestamp: new Date().toISOString(),
23 url: window.location.href,
24 date: new Date().toLocaleString()
25 };
26
27 // Add to alerts array
28 alerts.push(alertEntry);
29
30 // Save back to database
31 await GM.setValue('username_alerts', JSON.stringify(alerts));
32
33 // Report
34 // console.log(await GM.listValues());
35 }
36
37 async function searchForUsername(targetUsername) {
38 // Find all username links in the search results
39 // Usernames appear in links with href pattern "https://avatars.imvu.com/[username]"
40 const usernameLinks = document.querySelectorAll('a[href*="avatars.imvu.com/"]');
41
42 let found = false;
43
44 for (const link of usernameLinks) {
45 const href = link.getAttribute('href');
46 // Extract username from URL
47 const match = href.match(/avatars\.imvu\.com\/(.+)/);
48 if (match && match[1]) {
49 const username = match[1];
50
51 // Check if this is the username we're looking for (case-insensitive)
52 if (username.toLowerCase() === targetUsername.toLowerCase()) {
53 found = true;
54
55 // Save to database
56 await saveAlertToDatabase(username);
57
58 console.log('Username "' + username + '" found on this page!');
59 }
60 }
61 }
62
63 return found;
64 }
65
66 function setupAutoRefresh() {
67 // Refresh page every minute (60000 milliseconds)
68 setTimeout(() => {
69 window.location.reload();
70 }, 60000);
71 }
72
73 async function init() {
74 // The username to search for
75 const targetUsername = 'Nobody';
76
77 // Setup auto-refresh
78 setupAutoRefresh();
79
80 // Wait for page to fully load
81 if (document.readyState === 'loading') {
82 document.addEventListener('DOMContentLoaded', () => searchForUsername(targetUsername));
83 } else {
84 // Page already loaded
85 await searchForUsername(targetUsername);
86 }
87 }
88
89 init();
90})();