Af_comics_cad filter update

Like a month ago CAD updated its whole design and file structure. That means that the filter is no longer working.

The following patch should make it work again (been testing it for a week or so without issues):

diff --git a/plugins/af_comics/filters/af_comics_cad.php b/plugins/af_comics/filters/af_comics_cad.php
index 43836724..11fc3374 100644
--- a/plugins/af_comics/filters/af_comics_cad.php
+++ b/plugins/af_comics/filters/af_comics_cad.php
@@ -8,23 +8,19 @@ class Af_Comics_Cad extends Af_ComicFilter {
        function process(&$article) {
                $owner_uid = $article["owner_uid"];
 
-               if (strpos($article["link"], "cad-comic.com/cad/") !== FALSE) {
-                       if (strpos($article["title"], "News:") === FALSE) {
+               if (strpos($article["link"], "cad-comic.com/comic/") !== FALSE) {
+                       $doc = new DOMDocument();
+                       @$doc->loadHTML(fetch_file_contents($article["link"]));
 
-                               $doc = new DOMDocument();
-                               @$doc->loadHTML(fetch_file_contents($article["link"]));
+                       $basenode = false;
 
-                               $basenode = false;
+                       if ($doc) {
+                               $xpath = new DOMXPath($doc);
+                               $basenode = $xpath->query("(//a[@href='". $article["link"] ."']/img)")->item(0);
 
-                               if ($doc) {
-                                       $xpath = new DOMXPath($doc);
-                                       $basenode = $xpath->query('(//img[contains(@src, "/comics/cad-")])')->item(0);
-
-                                       if ($basenode) {
-                                               $article["content"] = $doc->saveXML($basenode);
-                                       }
+                               if ($basenode) {
+                                       $article["content"] = $doc->saveXML($basenode);
                                }
-
                        }
 
                        return true;

EDIT: not 100% sure this is the right way to suggest it, just used the old instructions and tried to translate them the best I could to Discourse

EDIT2: re-created my gitlab user with the toote username as well

tim buckley also hates russia now for some reason. such loss. :wink:

naboo:~:% HEAD cad-comic.com/cad/
403 Forbidden
Cache-Control: max-age=10

anyway, you should have proper permissions now, so post a merge request, etc.

Created. https://tt-rss.org/fox/tt-rss/merge_requests/52

Thanks a lot for the quick turnaround