package Service;

import Model.ResultEntity;

/**
 * Created by 王渝 on 2016-10-15.
 * Email : wwangyuu@outlook.com
 * University : University of Electronic Science and Technology of Zhangjiang
 */
public class OfficialDocs_JavaScript implements IService {
    @Override
    public ResultEntity getResult(String keyword) {
        return null;
    }
}

@@ -37,16 +37,209 @@
 tEntity;
+%0Aimport Model.DocType;%0Aimport Model.Item;%0Aimport org.jsoup.Jsoup;%0Aimport org.jsoup.nodes.Document;%0Aimport org.jsoup.nodes.Element;%0Aimport org.jsoup.select.Elements;%0A%0Aimport java.io.IOException;
 %0A%0A/**%0A *
@@ -254,10 +254,20 @@
  by 
-%E7%8E%8B%E6%B8%9D
+Mengxiao Lin
  on 
@@ -293,235 +293,1371 @@
 l : 
-wwangyuu@outlook.com%0A * University : University of Electronic Science and Technology of Zhangjiang%0A */%0Apublic class OfficialDocs_JavaScript implements IService %7B%0A    @Override%0A    public ResultEntity getResult(String keyword) %7B
+linmx0130@163.com%0A */%0Apublic class OfficialDocs_JavaScript implements IService %7B%0A    private static final String MDN_SEARCH =%0A            %22https://developer.mozilla.org/en-US/search?topic=js&topic=api&topic=webdev&q=%22;%0A    @Override%0A    public ResultEntity getResult(String keyword) %7B%0A        ResultEntity en = new ResultEntity();%0A        String html = NetWorking.GET(MDN_SEARCH + keyword);%0A        Document doc = Jsoup.parse(html);%0A        Elements search_results = doc.getElementsByClass(%22result-list%22).first().children();%0A        for (Element ele : search_results)%7B%0A            Element resultItem = ele.getElementsByClass(%22result-list-item%22).first();%0A            Element resultLink = ele.getElementsByTag(%22h4%22).first().getElementsByTag(%22a%22).first();%0A            Element summary = ele.getElementsByTag(%22p%22).first();%0A%0A            String title = resultLink.text();%0A            String link = resultLink.attr(%22href%22);%0A            String summaryText = summary.text();%0A            String summaryHtml = summary.html();%0A%0A            System.out.println(href);%0A            System.out.println(title);%0A            System.out.println(summary_text);%0A            System.out.println(summary_html);%0A            System.out.println(%22---------------------------%22);%0A            Item i = new Item(DocType.OfficialDocs, title, summary_text, href);%0A            en.addItem(i);%0A        %7D
 %0A   

add MDN for js