Browse Source

updated README, fixed an issue with text result API

hnh.mtf 3 years ago
parent
commit
112f9d9627
3 changed files with 22 additions and 18 deletions
  1. 19 15
      README.md
  2. 3 2
      api.php
  3. 0 1
      config.php

+ 19 - 15
README.md

@@ -52,24 +52,28 @@ Where `q` is the keyword, `p` is the result page (the first page is `0`) and `ty
 <br/><br/>
 JSON result:
 + In case of text search:
-  + `title`: Title of the result site
-  + `url`: Full URL of the result
-  + `base_url`: The base URL of the result (e.g.: http://example.com/test.php ->  http://example.com/)
+  + If the query is a special query (e.g.: currency conversion, wikipedia result etc.):
+    + `special_response`:
+      + `response`
+      + `source`
+  + `title`
+  + `url`
+  + `base_url`: (e.g.: http://example.com/test.php ->  http://example.com/)
 + In case of image search:
-  + `base64`: The result image converted to base64 format
-  + `alt`: The description of the image
+  + `base64`: the result image converted to base64 format
+  + `alt`: the description of the image
 + In case of video search:
-  + `title`: Title of the result video
-  + `url`: Full URL of the video
-  + `base_url`: The base URL of the result (e.g.: http://youtube.com/watch ->  http://youtube.com/)
+  + `title`
+  + `url`
+  + `base_url`: (e.g.: http://youtube.com/watch ->  http://youtube.com/)
 + In case of torrent search:
-  + `hash`: Hash of the torrent
-  + `name`: Name of the torrent
-  + `seeders`: The amount of seeders
-  + `leechers`: The amount of leechers
-  + `size`: The size of the files in human readable format
-  + `source`: Where the torrent was fetched from
-  + `magnet`: The magnet link
+  + `hash`
+  + `name`
+  + `seeders`
+  + `leechers`
+  + `size`
+  + `source`
+  + `magnet`
 
 <br/>
 The API also supports both GET and POST requests

+ 3 - 2
api.php

@@ -7,7 +7,8 @@
         die();
     }
 
-    $query_encoded = urlencode($_REQUEST["q"]);
+    $query = $_REQUEST["q"];
+    $query_encoded = urlencode($query);
     $page = isset($_REQUEST["p"]) ? (int) $_REQUEST["p"] : 0;
     $type = isset($_REQUEST["type"]) ? (int) $_REQUEST["type"] : 0;
 
@@ -17,7 +18,7 @@
     {
         case 0:
             require "engines/google/text.php";
-            $results = get_text_results($query_encoded, $page);
+            $results = get_text_results($query, $page);
             break;
         case 1:
             require "engines/google/image.php";

+ 0 - 1
config.php

@@ -8,7 +8,6 @@
     // Results will be in this language
     $config_google_language = "en";
 
-    // Disable BitTorrent search
     $config_disable_bittorent_search = false;
     $config_bittorent_trackers = "&tr=http%3A%2F%2Fnyaa.tracker.wf%3A7777%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Fexodus.desync.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.torrent.eu.org%3A451%2Fannounce";