Пример #1
0
 function GetCatalog()
 {
     $uri = 'http://www.77nt.com/';
     $html = http_proxy_get($uri, "*****@*****.**");
     $html = str_replace("text/html; charset=gb2312", "text/html; charset=gb18030", $html);
     $xpath = new XPath($html);
     $elements = $xpath->query("//div[@id='nav']/li[@class='menu_test']/a");
     $subcatalogs = array();
     $subcatalogs["最近更新"] = 'http://www.77nt.com/1';
     $subcatalogs["排行榜"] = 'http://www.77nt.com/2';
     $host = parse_url($uri);
     foreach ($elements as $element) {
         $href = $element->getattribute('href');
         $subcatalog = $element->nodeValue;
         if (strlen($href) > 0 && strlen($subcatalog) > 0) {
             $subcatalogs[$subcatalog] = 'http://' . $host["host"] . '/' . $href;
         }
     }
     $catalog = array();
     $catalog["小说"] = $subcatalogs;
     return $catalog;
 }
Пример #2
0
 function Search($keyword)
 {
     $uri = "http://www.ysts8.com/Ys_so.asp?stype=1&keyword=" . urlencode(iconv("UTF-8", "gb2312", $keyword));
     $response = http_proxy_get($uri, "Ysjs/bot.js", 10);
     $response = str_replace("text/html; charset=gb2312", "text/html; charset=gb18030", $response);
     $books = array();
     $n = $this->__SearchPageCount($response);
     for ($i = 1; $i <= $n; $i++) {
         if ($i > 1) {
             $uri = "http://www.ysts8.com/Ys_so.asp?stype=1&keyword=" . urlencode(iconv("UTF-8", "gb2312", $keyword)) . "page=" . $i;
             $response = http_proxy_get($uri, "Ysjs/bot.js", 10);
             $response = str_replace("text/html; charset=gb2312", "text/html; charset=gb18030", $response);
         }
         $this->__ParseBooks($uri, $response, $books, "//div[@class='pingshu_ysts8']/ul/li/a");
     }
     return array("book" => $books);
 }
Пример #3
0
 function Search($keyword)
 {
     $keyword = urlencode(iconv("UTF-8", "gb2312", $keyword));
     $uri = 'http://www.imanhua.com/v2/user/search.aspx?key=' . $keyword;
     $html = http_proxy_get($uri, "footer", 10);
     $html = str_replace("text/html; charset=gb2312", "text/html; charset=gb18030", $html);
     $xpath = new XPath($html);
     $page = $xpath->get_value("//div[@class='pagerHead']/strong[3]", null, 1);
     $books = array();
     $host = parse_url($uri);
     for ($i = 1; $i <= $page; $i++) {
         if (1 != $i) {
             $u = "http://www.imanhua.com/v2/user/search.aspx?key={$keyword}&p={$i}";
             $html = http_proxy_get($u, "footer", 10);
             $html = str_replace("text/html; charset=gb2312", "text/html; charset=gb18030", $html);
             $xpath = new XPath($html);
         }
         $elements = $xpath->query("//div[@class='bookChrList']/ul/ul/li");
         foreach ($elements as $element) {
             $book = $xpath->get_attribute("div[@class='intro']/h2/a", "title", $element, "");
             $href = $xpath->get_attribute("div[@class='intro']/h2/a", "href", $element, "");
             $icon = $xpath->get_attribute("div[@class='cover']/a/img", "src", $element, "");
             $time = $xpath->get_attribute("div[@class='intro']/em/a", "title", $element, "");
             $status = $xpath->get_value("div[@class='intro']/em/a", $element, "");
             if (strlen($href) > 0 && strlen($book) > 0) {
                 $bookid = basename($href);
                 $time = substr($time, strpos($time, ":") + 1);
                 $books[$bookid] = array("bookid" => $bookid, "book" => $book, "icon" => $icon, "time" => $time, "status" => $status);
             }
         }
     }
     return $books;
 }
Пример #4
0
 function GetCatalog()
 {
     $uri = 'http://www.xxbh.net/';
     $html = http_proxy_get($uri, "template/xxbh", 10);
     $html = str_replace("text/html; charset=gb2312", "text/html; charset=gb18030", $html);
     $catalog = array();
     $catalog["最近更新"] = '/comicone/page_a.html';
     $catalog["排行榜"] = 'comicone/page_b.html';
     $xpath = new XPath($html);
     $elements = $xpath->query("//ul[@class='ul4']/li/a");
     foreach ($elements as $element) {
         $href = $element->getattribute('href');
         $text = $element->nodeValue;
         if (strlen($href) > 1 && strlen($text) > 0) {
             $catalog[$text] = $href;
         }
     }
     return $catalog;
 }