我正在編寫一個示例基於Web的應用程序,它要求以XML文檔的形式交付基於圖像的結果。目前我正在使用Picasa搜索API。我正在獲取請求API調用URL的XML響應。 這是我目前的執行:什麼是Picasa Search API的一些不錯的選擇?
private void fetchImageURLs() {
try {
String urlString = "https://picasaweb.google.com/data/feed/api/all?";
urlString += "q="+searchTerm;
urlString += "&max-results="+numImages;
urlString += "&start-index="+offset;
// Get XML from Picasa API
URL url = new URL(urlString);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(url.openStream());
doc.getDocumentElement().normalize();
// Parse XML to obtain image URLs
NodeList nList = doc.getElementsByTagName("content");
for (int i = 0; i < nList.getLength(); i++) {
Node nNode = nList.item(i);
Element eElement = (Element) nNode;
String imageUrlString = eElement.getAttribute("src");
// Push the image URLs on the queue to be used by fetchImagesAndSave()
imageURLs.push(new URL(imageUrlString));
}
}
catch (Exception e) {
e.printStackTrace();
}
}
我會感激,如果你能幫助我搞清楚如何使用Twitter/Facebook的/的photobucket或Flickr API做同樣的。 謝謝。
您應該先嚐試一下。這不是一個網站,旨在讓人們完全爲你完成一項任務(即使有些人是這麼做的)。 – AHungerArtist 2013-04-24 10:01:47
你似乎在這裏問很多。爲什麼不嘗試先尋求幫助,然後尋求具體問題的幫助...... – AngryDuck 2013-04-24 10:09:20