summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Posselt <Raydiation@users.noreply.github.com>2013-09-30 15:50:34 -0700
committerBernhard Posselt <Raydiation@users.noreply.github.com>2013-09-30 15:50:34 -0700
commit0381dddcaf5fd2d63472a4ad970a4f44946b4c28 (patch)
tree08f10f27c9cf8a4c305db42dd8380f630db9d98f
parent215e8846e8edef5f7289b518d5e5fb0d7b35bee3 (diff)
parent2e128befdac4ee892d82e09fc6c299ec6e8aad29 (diff)
Merge pull request #383 from owncloud/enhancer-useragent
Set the user agent when getting the full body for xpath enhancers
-rw-r--r--articleenhancer/xpatharticleenhancer.php4
-rw-r--r--articleenhancer/xpathenhancers.json11
-rw-r--r--utility/simplepiefilefactory.php6
3 files changed, 14 insertions, 7 deletions
diff --git a/articleenhancer/xpatharticleenhancer.php b/articleenhancer/xpatharticleenhancer.php
index 77a16f04d..93ceaf896 100644
--- a/articleenhancer/xpatharticleenhancer.php
+++ b/articleenhancer/xpatharticleenhancer.php
@@ -61,7 +61,7 @@ class XPathArticleEnhancer implements ArticleEnhancer {
foreach($this->regexXPathPair as $regex => $search) {
if(preg_match($regex, $item->getUrl())) {
- $file = $this->fileFactory->getFile($item->getUrl(), $this->maximumTimeout);
+ $file = $this->fileFactory->getFile($item->getUrl(), $this->maximumTimeout, "Mozilla/5.0 AppleWebKit");
// convert encoding by detecting charset from header
$contentType = $file->headers['content-type'];
@@ -215,4 +215,4 @@ class XPathArticleEnhancer implements ArticleEnhancer {
}
-} \ No newline at end of file
+}
diff --git a/articleenhancer/xpathenhancers.json b/articleenhancer/xpathenhancers.json
index d9eebd0f7..8aa7c5efb 100644
--- a/articleenhancer/xpathenhancers.json
+++ b/articleenhancer/xpathenhancers.json
@@ -64,7 +64,14 @@
},
"niceteethcomic.com": {
"%niceteethcomic.com/archives%": "//*[@class=\"comicpane\"]/a/img"
+ },
+ "awkwardzombie.com" :{
+ "%awkwardzombie.com/index.php\\?comic=%": "//*[@id=\"comic\"]/img"
+ },
+ "vgcats.com": {
+ "%vgcats.com/comics%": "//*[@align=\"center\"]/img"
+ },
+ "vgcats.com/super": {
+ "%vgcats.com/super%": "//div[@align=\"center\"]/p/img"
}
}
-
-
diff --git a/utility/simplepiefilefactory.php b/utility/simplepiefilefactory.php
index 13b56dc9e..5f1867c38 100644
--- a/utility/simplepiefilefactory.php
+++ b/utility/simplepiefilefactory.php
@@ -28,8 +28,8 @@ namespace OCA\News\Utility;
class SimplePieFileFactory {
- public function getFile($url, $timeout) {
- return new \SimplePie_File($url, $timeout);
+ public function getFile($url, $timeout, $userAgent = null) {
+ return new \SimplePie_File($url, $timeout, null, null, $userAgent);
}
-} \ No newline at end of file
+}