mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-22 11:02:35 +01:00
+ Added TODO & remove unused lines.
This commit is contained in:
parent
821acf12d8
commit
4def715b25
@ -157,35 +157,34 @@ public class YoutubeSearchEngine implements SearchEngine {
|
|||||||
String url = builder.build().toString();
|
String url = builder.build().toString();
|
||||||
|
|
||||||
String response = Downloader.download(url);
|
String response = Downloader.download(url);
|
||||||
DocumentBuilderFactory dbFactory
|
|
||||||
= DocumentBuilderFactory.newInstance();
|
//TODO: Parse xml data using Jsoup not done
|
||||||
DocumentBuilder dBuilder = null;
|
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
|
||||||
|
DocumentBuilder dBuilder;
|
||||||
|
org.w3c.dom.Document doc = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dBuilder = dbFactory.newDocumentBuilder();
|
dBuilder = dbFactory.newDocumentBuilder();
|
||||||
} catch (ParserConfigurationException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
org.w3c.dom.Document doc = null;
|
|
||||||
try {
|
|
||||||
doc = dBuilder.parse(new InputSource(new ByteArrayInputStream(response.getBytes("utf-8"))));
|
doc = dBuilder.parse(new InputSource(new ByteArrayInputStream(response.getBytes("utf-8"))));
|
||||||
} catch (SAXException e) {
|
doc.getDocumentElement().normalize();
|
||||||
e.printStackTrace();
|
}catch (ParserConfigurationException | SAXException | IOException e) {
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
doc.getDocumentElement().normalize();
|
|
||||||
|
|
||||||
|
if(doc!=null){
|
||||||
NodeList nList = doc.getElementsByTagName("CompleteSuggestion");
|
NodeList nList = doc.getElementsByTagName("CompleteSuggestion");
|
||||||
for (int temp = 0; temp < nList.getLength(); temp++) {
|
for (int temp = 0; temp < nList.getLength(); temp++) {
|
||||||
|
|
||||||
NodeList nList1 = doc.getElementsByTagName("suggestion");
|
NodeList nList1 = doc.getElementsByTagName("suggestion");
|
||||||
Node nNode1 = nList1.item(temp)
|
Node nNode1 = nList1.item(temp);
|
||||||
;
|
|
||||||
if (nNode1.getNodeType() == Node.ELEMENT_NODE) {
|
if (nNode1.getNodeType() == Node.ELEMENT_NODE) {
|
||||||
org.w3c.dom.Element eElement = (org.w3c.dom.Element) nNode1;
|
org.w3c.dom.Element eElement = (org.w3c.dom.Element) nNode1;
|
||||||
suggestions.add(eElement.getAttribute("data"));
|
suggestions.add(eElement.getAttribute("data"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
Log.e(TAG, "GREAT FUCKING ERROR");
|
||||||
|
}
|
||||||
return suggestions;
|
return suggestions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user