1碎鑽
我剖析這個網頁~~這個網頁~~
出現了錯誤
我用DEBUG模式看,沒有發現任何錯誤,但卻發現在這一段發現沒有辦法剖析html資訊Document doc;
doc = Jsoup.parse(url, 3000); Html資訊無法被分析出來,後面的程式所以無法的到資料
想請教各位高手有無碰過類似的情況
(目前我還未找到相關的解決方法)
謝謝private OnClickListener btsearchitemListener = new OnClickListener()
{
public void onClick(View v)
{
// TODO Auto-generated method stub
Handler handler = new Handler();
handler.post(new Runnable() {
//User_menu.this.runOnUiThread(new Runnable(){
public void run() {
// TODO Auto-generated method stub
editText1.setHint("");
URL url ;
String Http_keyWord = "http://tw.search.bid.yahoo.com/search/auction/product?p=%s", Http, Keyword;
//String Http_keyWord = "https://tw.search.yahoo.com/search?p=u+zj6&fr=yfp&ei=utf-8&v=0", Http, Keyword;
AllDatainfos = new ArrayList<HashMap<String, Object>>();
Keyword = editText1.getText().toString().trim();
tvspottempp = (TextView)findViewById(R.id.tvspottempp);
tvspottempp.setText("Keyword:"+Keyword);
Http = String.format(Http_keyWord, UTF8EnCode(Keyword));
tvspottempp1 = (TextView)findViewById(R.id.tvspottempp1);
tvspottempp1.setText("Http:"+Http);
try
{
url = new URL(Http.toString());
tvspottempp2 = (TextView)findViewById(R.id.tvspottempp2);
tvspottempp2.setText("url:"+url);
Document doc;
doc = Jsoup.parse(url, 3000);
tvspottempp2 = (TextView)findViewById(R.id.tvspottempp3);
tvspottempp2.setText("doc:"+doc);
Elements paramDocuments = doc.select("#srp_result_list, #srp_gaze_list").select(".grid-type.yui3-g > *");
Iterator localIterator = paramDocuments.select("#srp_result_list, #srp_gaze_list").select(".grid-type.yui3-g > *").iterator();
while (true)
{
if (!localIterator.hasNext())
return;
Element localElement1 = (Element)localIterator.next();
try
{
SearchResultItem localSearchResultItem = new SearchResultItem();
Element localElement2 = localElement1.select(".wrap").first();
parsePhoto(localSearchResultItem, localElement2);
parsePrice(localSearchResultItem, localElement2);
parseTitle(localSearchResultItem, localElement2);
}
catch (Exception localException2)
{
localException2.printStackTrace();
}
}
}catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (Exception localException1)
{
localException1.printStackTrace();
}
}
});
}
}; |

|