-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBingSearchBot.java
More file actions
45 lines (36 loc) · 1.74 KB
/
BingSearchBot.java
File metadata and controls
45 lines (36 loc) · 1.74 KB
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
import java.net.URLEncoder;
import java.util.Random;
public class BingSearchBot {
// Generate a different random search term each time
public static String generateRandomQuery(int i) {
String[] topics = {
"AI", "Java", "OpenAI", "ChatGPT", "Quantum Computing", "SpaceX", "NASA",
"Neural Networks", "Cryptocurrency", "Cybersecurity", "Machine Learning",
"Climate Change", "Famous Movies", "Latest Tech News", "Programming Tips",
"Android Development", "Web 3.0", "Cloud Computing", "Deep Learning", "C++",
"Python", "Rust language", "Linux commands", "Edge browser", "Hacking tools"
};
Random rand = new Random();
String topic = topics[rand.nextInt(topics.length)];
return topic + " " + i;
}
public static void main(String[] args) {
int totalSearches = 10;
int delaySeconds = 2;
for (int i = 1; i <= totalSearches; i++) {
try {
String query = generateRandomQuery(i);
String encodedQuery = URLEncoder.encode(query, "UTF-8");
String searchUrl = "https://www.bing.com/search?q=" + encodedQuery;
// Windows-specific Edge path (check location on your system)
String edgePath = "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe";
ProcessBuilder pb = new ProcessBuilder(edgePath, searchUrl);
pb.start();
System.out.println("[" + i + "] Searching: \"" + query + "\" in Microsoft Edge");
Thread.sleep(delaySeconds * 1000L);
} catch (Exception e) {
System.out.println("[" + i + "] Error: " + e.getMessage());
}
}
}
}