-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSearchSub.java
More file actions
27 lines (26 loc) · 948 Bytes
/
Copy pathSearchSub.java
File metadata and controls
27 lines (26 loc) · 948 Bytes
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
import java.net.*;
import java.io.*;
public class SearchSub{
public static void main(String [] args){
try{
String name = args[0];
URL url = new URL("https://socialblade.com/youtube/user/" + args[0]);
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
String line;
String cleanLine;
while((line = reader.readLine()) != null){
cleanLine=line.replaceAll("\\<.*?\\>", "");
if (cleanLine.contains("Subscribers")){
String veryClose = reader.readLine();
String finalClean = veryClose.replaceAll("\\<.*?\\>", "");
System.out.println(name +" has " + finalClean + " subscribers!");
break;
}
}
}
catch(Exception err){
System.out.println("Hmm that wasn't quite right. Make sure you entered valid credentials and retry");
System.out.println("Remember! Some youtuber's actual handles are different than what can appear\n on their Youtube Channel!");
}
}
}