Browse Source

Merge branch 'fix-jdb-autofill' of xoru/Gazelle into master

spaghetti 2 years ago
parent
commit
5cbce67f72
1 changed files with 21 additions and 8 deletions
  1. 21
    8
      sections/ajax/autofill/jav.php

+ 21
- 8
sections/ajax/autofill/jav.php View File

@@ -108,21 +108,34 @@ if (!$debug && $Cache->get_value('jav_fill_json_'.$cn)) {
108 108
   }
109 109
   if ($jdb_page) {
110 110
     if (!$title) {
111
-      $title = substr($jdb->query('//h3')[0]->nodeValue, strlen($cn)+1);
111
+      $title = trim(substr($jdb->query("//h1[contains(@class, 'entry-title')]")[0]->nodeValue, strlen($cn) + 3));
112 112
     }
113
-    if (!idols) {
114
-      $idols_raw = $jdb->query("//div[@class='movieinfo']")[0]->childNodes[2]->childNodes[0]->childNodes;
115
-      foreach ($idols_raw as $key => $idol) {
116
-        if ($key % 2 != 0) {
117
-          $idols[] = $idol->nodeValue;
113
+    if (!$studio) {
114
+      $studio = $jdb->query("//b[contains(., 'Studio:')]")[0]->nextSibling->nodeValue;
115
+    }
116
+    if (!$label) {
117
+      $label = $jdb->query("//b[contains(., 'Label:')]")[0]->nextSibling->nodeValue;
118
+    }
119
+    if (!$idols) {
120
+      $idols_raw = $jdb->query("//b[contains(., 'Idol(s): ')]")[0]->nextSibling;
121
+
122
+      for ($i = 0; $i < 10; $i++) {
123
+        if ($idols_raw->tagName == "a") {
124
+          $idol_name = $idols_raw->nodeValue;
125
+          $idol_lower = strtolower(str_replace(' ', '-', $idol_name));
126
+          // ensure it's actually an idol name
127
+          if (strpos($idols_raw->attributes->item(0)->nodeValue, '.com/idols/' . $idol_lower) !== false) {
128
+            $idols[] = $idols_raw->nodeValue;
129
+          }
118 130
         }
131
+        $idols_raw = $idols_raw->nextSibling;
119 132
       }
120 133
     }
121 134
     if (!$year) {
122
-       $year = substr($jdb->query("//div[@class='movieinfo']")[0]->childNodes[1]->childNodes[0]->nodeValue, strlen("Release Date: "), 4);
135
+      $year = substr($jdb->query("//b[contains(., 'Release Date:')]")[0]->nextSibling->nodeValue, 1, 4);
123 136
     }
124 137
     if (!$image) {
125
-      $image = $jdb->query('//*[@class="cover"]/a/img')->item(0)->getAttribute('src');
138
+      $image = $jdb->query("//img[contains(@alt, ' download or stream.')]")->item(0)->getAttribute('src');
126 139
     }
127 140
     if (substr($image, 0, 2) == '//') {
128 141
       $image = 'https:'.$image;

Loading…
Cancel
Save