000 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 029 030 031 032 033 034
| import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class test2 {
public static void main(String args[]) {
try {
URL url = new URL("h**p://ca.finance.yahoo.com/q?s=" + "CU.TO");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String inputLine;
String match = "";
String s = "";
String s2 = "";
while ((inputLine = in.readLine()) != null) {
s += inputLine;
}
in.close();
Pattern p = Pattern.compile("h**p:\\/\\/ca.rd.yahoo.com\\/finance\\/quotes\\/internal\\/summary\\/download\\/\\*h**p[^\"]*");
Matcher m2 = p.matcher(s);
s2 = "";
while (m2.find()) {
s2 += "Found: " + m2.group() + "\n";
}
System.out.println(s2);
} catch (Exception e) {
}
}
}
|