Browse Source

Improve e-hentai API

spaghetti 8 years ago
parent
commit
83375cc309
1 changed files with 7 additions and 3 deletions
  1. 7
    3
      sections/ajax/doujin.php

+ 7
- 3
sections/ajax/doujin.php View File

@@ -16,7 +16,7 @@ if (empty($gid) || empty($token)) {
16 16
   json_die("failure", "Invalid URL");
17 17
 }
18 18
 
19
-if ($Cache->get_value('doujin_json_'.$gid) && false) {
19
+if ($Cache->get_value('doujin_json_'.$gid)) {
20 20
   json_die("success", $Cache->get_value('doujin_json_'.$gid));
21 21
 } else {
22 22
 
@@ -39,6 +39,7 @@ if ($Cache->get_value('doujin_json_'.$gid) && false) {
39 39
   $tags = array();
40 40
   $lang = NULL;
41 41
   $circle = NULL;
42
+  $censored = true;
42 43
   foreach ($json["tags"] as $tag) {
43 44
     if (strpos($tag, ':') !== false) {
44 45
       list($namespace, $tag) = explode(':', $tag);
@@ -50,6 +51,8 @@ if ($Cache->get_value('doujin_json_'.$gid) && false) {
50 51
       $lang = empty($lang) ? ucfirst($tag) : $lang;
51 52
     } else if ($namespace == "group") {
52 53
       $circle = empty($circle) ? ucfirst($tag) : $circle;
54
+    } else if ($tag == "uncensored") {
55
+      $censored = false;
53 56
     } else {
54 57
       if ($namespace) { $tag = $tag.':'.$namespace; }
55 58
       array_push($tags, str_replace(' ', '.', $tag));
@@ -58,10 +61,11 @@ if ($Cache->get_value('doujin_json_'.$gid) && false) {
58 61
 
59 62
   $json_str = array(
60 63
     'id' => $gid,
61
-    'title' => $json['title'],
62
-    'title_jp' => $json['title_jpn'],
64
+    'title' => html_entity_decode($json['title'], ENT_QUOTES),
65
+    'title_jp' => html_entity_decode($json['title_jpn'], ENT_QUOTES),
63 66
     'artists' => $artists,
64 67
     'circle' => $circle,
68
+    'censored' => $censored,
65 69
     'year' => NULL,
66 70
     'tags' => $tags,
67 71
     'lang' => $lang,

Loading…
Cancel
Save