我正在尝试创建一个从网站复制特定文本的应用程序,并在输出中将其提供给我。
例如;要访问www.sheeel.com并复制产品名称和价格。
任何人都可以提供帮助吗?
package posts;
import javax.swing.JOptionPane;
public class Posts {
public static void main(String[] args) {
Object[] options = {"Kuwait", "KSA", "Exit"};
int selected = JOptionPane.showOptionDialog(null, "Which Website?", "Website", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, options, options[0]);
int linkN = 0;
String link = null;
String dealName;
if (selected == 2) {
JOptionPane.showMessageDialog(null, "Thank you");
}
if (selected < 2) {
while (selected == 0) {
Object[] options2 = {"Main Deal", "Special Corner", "Under 5", "Coupons", "Exit"};
int web = JOptionPane.showOptionDialog(null, "Which Category?", "Category", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, options2, options2[0]);
if (web == 0) {
link = "www.sheeel.com";
}
if (web == 1) {
link = "http://www.sheeel.com/special-corner.html";
}
if (web == 2) {
link = "http://www.sheeel.com/under-5-kd.html";
}
if (web == 3) {
link = "http://www.sheeel.com/coupons-kwt.html";
}
if (web == 4) {
JOptionPane.showMessageDialog(null, "Thank you");
System.exit(0);
}
dealName = JOptionPane.showInputDialog("Deal Name:");
String price;
price = JOptionPane.showInputDialog("Enter Price:");
System.out.println("شيييل," + " " + dealName + "," + "فقط بـ" + " " + price + " " + "من " + " " + link);
} //while end
while (selected == 1) {
Object[] options2 = {"Main Deal", "Special Corner", "Under 5", "Coupons", "Exit"};
int web = JOptionPane.showOptionDialog(null, "Which Category?", "Category", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, options2, options2[0]);
if (web == 0) {
link = "http://www.sheeel.com/ksa/";
}
if (web == 1) {
link = "http://www.sheeel.com/ksa/special-corner-192.html";
}
if (web == 2) {
link = "http://www.sheeel.com/ksa/under-99.html";
}
if (web == 3) {
link = "http://www.sheeel.com/ksa/cards-ksa.html";
}
if (web == 4) {
JOptionPane.showMessageDialog(null, "Thank you");
System.exit(0);
}
dealName = JOptionPane.showInputDialog("Deal Name:");
String price;
price = JOptionPane.showInputDialog("Enter Price:");
System.out.println("شيييل," + " " + dealName + ", " + "فقط بـ" + " " + price + " " + "من " + link);
}
}
}
}