]> git.wh0rd.org - tt-rss.git/commitdiff
af_comics: add happyjar
authorAndrew Dolgov <noreply@fakecake.org>
Mon, 10 Feb 2014 19:03:58 +0000 (23:03 +0400)
committerAndrew Dolgov <noreply@fakecake.org>
Mon, 10 Feb 2014 19:03:58 +0000 (23:03 +0400)
include/functions.php
plugins/af_comics/init.php

index 821ca83f07344a5b1211727b5f764e57f8ee9bea..8e8832a58a2dedb3200c9682e9b64fd6d48fb020 100644 (file)
                }
        }
 
-       function fetch_file_contents($url, $type = false, $login = false, $pass = false, $post_query = false, $timeout = false, $timestamp = 0) {
+       function fetch_file_contents($url, $type = false, $login = false, $pass = false, $post_query = false, $timeout = false, $timestamp = 0, $useragent = false) {
 
                global $fetch_last_error;
                global $fetch_last_error_code;
                        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
                        curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
-                       curl_setopt($ch, CURLOPT_USERAGENT, SELF_USER_AGENT);
+                       curl_setopt($ch, CURLOPT_USERAGENT, $useragent ? $useragent :
+                               SELF_USER_AGENT);
                        curl_setopt($ch, CURLOPT_ENCODING, "");
                        curl_setopt($ch, CURLOPT_REFERER, $url);
 
index e8b5a00ccbd4ae0e921a4c94a72ac6844e6c11d5..5d3ccf07229231bfd63b8dfe15d95c6c3d98d6c9 100644 (file)
@@ -30,6 +30,7 @@ class Af_Comics extends Plugin {
                <li>Dilbert</li>
                <li>Explosm</li>
                <li>GoComics</li>
+               <li>Happy Jar</li>
                <li>Penny Arcade</li>
                <li>Three word phrase</li>
                <li>Whomp</li>";
@@ -48,12 +49,21 @@ class Af_Comics extends Plugin {
                if (strpos($article["guid"], "bunicomic.com") !== FALSE ||
                                strpos($article["guid"], "buttersafe.com") !== FALSE ||
                                strpos($article["guid"], "whompcomic.com") !== FALSE ||
+                               strpos($article["guid"], "happyjar.com") !== FALSE ||
                                strpos($article["guid"], "csectioncomics.com") !== FALSE) {
 
                         if (strpos($article["plugin_data"], "af_comics,$owner_uid:") === FALSE) {
 
+
+                               // lol at people who block clients by user agent
+                               // oh noes my ad revenue Q_Q
+
+                               $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)");
+
                                $doc = new DOMDocument();
-                               @$doc->loadHTML(fetch_file_contents($article["link"]));
+                               @$doc->loadHTML($res);
 
                                $basenode = false;