From: Antonio Ospite Date: Thu, 22 Jun 2017 08:52:41 +0000 (+0200) Subject: Add an example of instrumentation to capture the HTML for later analysis X-Git-Tag: v1.1.0~3 X-Git-Url: https://git.ao2.it/tweeper.git/commitdiff_plain/a856c32be547851704a7307e240e273f852e9f97?ds=sidebyside Add an example of instrumentation to capture the HTML for later analysis --- diff --git a/tests/instument_to_catch_promoted_tweets.diff b/tests/instument_to_catch_promoted_tweets.diff new file mode 100644 index 0000000..3f27dd5 --- /dev/null +++ b/tests/instument_to_catch_promoted_tweets.diff @@ -0,0 +1,20 @@ +diff --git a/src/Tweeper.php b/src/Tweeper.php +index 8ac2fe3..c45aab5 100644 +--- a/src/Tweeper.php ++++ b/src/Tweeper.php +@@ -355,6 +355,15 @@ class Tweeper { + $html = call_user_func_array(array($this, $preprocess_html_host_method), array($html)); + } + ++ // XXX REMOVE: instrumentation to catch promoted tweets ++ if ($host == "twitter.com") { ++ $twitter_promoted_match_expr = '/promoted/i'; ++ $ret = preg_match($twitter_promoted_match_expr, $html, $matches); ++ if ($ret) { ++ file_put_contents("/home/ao2/TWITTER_PROMOTED_DUMP.html", $html); ++ } ++ } ++ + $xmlDoc = $this->htmlToXml($html, $host); + if (NULL === $xmlDoc) { + return NULL;