Tiny Tiny RSS: Community

Plugin to get images from sailinganarchy forum

Is anyone aware of a plugin that would properly grab all images in forum posts from http://forums.sailinganarchy.com? I’ve attempted a few modifications of af_redditimgur, af_readability, and af_comics to no avail. For example, tt-rss isn’t pulling images for pages like:

Sometimes, the linked images are from http://forums.sailinganarchy.com/uploads… but they also aren’t appearing for links like https://lh3.googleusercontent.com/… and others.

Having said that, the images are pulling fine from other sailinganarchy pages:

I can’t figure out under what conditions it works vs. doesn’t.

Thanks.

Leveraging af_comics, I’ve put together this extension that provides a solution to the above problem:

<?php
class Af_SailingAnarchy extends Af_ComicFilter {

	function supported() {
		return array("Sailing Anarchy Forum");
	}

	function process(&$article) {

		if (strpos($article["guid"], "forums.sailinganarchy.com") !== FALSE) {

				$res = fetch_file_contents($article["link"], false, false, false,
					 false, false, 0,
					 "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)");

				global $fetch_last_error_content;

				if (!$res && $fetch_last_error_content)
					$res = $fetch_last_error_content;

				$doc = new DOMDocument();

				if (@$doc->loadHTML($res) && !$article["content"]) {
					$xpath = new DOMXPath($doc);

					$arr = explode('findComment&comment=', $article["link"]);
					$comment_div_id = (isset($arr[1])) ? "comment-" . $arr[1] . "_wrap" : "none";
					$query = '(//div[@id="' . 	$comment_div_id . '"])';

					$basenode = $xpath->query($query)->item(0);

					if (!empty($basenode))  { $article["content"] = $doc->saveHTML($basenode); }
				}

			 return true;
		}

		return false;
	}
}

Place in the plugins/af_comics/filters.local directory.