diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-10-18 14:28:01 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-10-18 14:28:01 +0200 |
commit | 6bc0c9a66075905725705ed425e5817e4f7c1767 (patch) | |
tree | 164819a5d0ed73d4f3284d4e17a17ad34eee8d59 /vendor/fguillot | |
parent | c335e5f349abe4e3d647c0ff57d12e23ef9ff20c (diff) |
update picofeed
Diffstat (limited to 'vendor/fguillot')
41 files changed, 634 insertions, 10 deletions
diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Html.php b/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Html.php index 36ab3f18c..c380a466f 100644 --- a/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Html.php +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Html.php @@ -88,9 +88,10 @@ class Html */ public function __construct($html, $website) { + $this->config = new Config; $this->input = XmlParser::HtmlToXml($html); $this->output = ''; - $this->tag = new Tag; + $this->tag = new Tag($this->config); $this->website = $website; $this->attribute = new Attribute(new Url($website)); } diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Tag.php b/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Tag.php index b14ed9481..6347054bb 100644 --- a/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Tag.php +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Filter/Tag.php @@ -3,7 +3,9 @@ namespace PicoFeed\Filter; use DOMXpath; + use PicoFeed\Parser\XmlParser; +use PicoFeed\Config\Config; /** * Tag Filter class @@ -14,6 +16,14 @@ use PicoFeed\Parser\XmlParser; class Tag { /** + * Config object + * + * @access private + * @var \PicoFeed\Config\Config + */ + private $config; + + /** * Tags blacklist (Xpath expressions) * * @access private @@ -71,6 +81,11 @@ class Tag 'q', ); + public function __construct(Config $config) + { + $this->config = $config; + } + /** * Check if the tag is allowed and is not a pixel tracker * @@ -130,7 +145,10 @@ class Tag */ public function isAllowedTag($tag) { - return in_array($tag, $this->tag_whitelist); + return in_array($tag, array_merge( + $this->tag_whitelist, + array_keys($this->config->getFilterWhitelistedTags(array())) + )); } /** diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/.wired.com.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/.wired.com.php index dcc47356f..5ae4c69f6 100644 --- a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/.wired.com.php +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/.wired.com.php @@ -4,10 +4,16 @@ return array( '%.*%' => array( 'test_url' => 'http://www.wired.com/gamelife/2013/09/ouya-free-the-games/', 'body' => array( - '//div[@class="entry"]', + '//div[@data-js="gallerySlides"]', + '//article', ), 'strip' => array( '//*[@id="linker_widget"]', + '//*[@class="credit"]', + '//div[@data-js="slideCount"]', + '//span[@class="visually-hidden"]', + '//*[@data-slide-number="_endslate"]', + '//*[@id="related"]', '//*[contains(@class, "bio")]', '//*[contains(@class, "entry-footer")]', '//*[contains(@class, "mobify_backtotop_link")]', @@ -15,7 +21,11 @@ return array( '//*[contains(@class, "gallery-thumbnail")]', '//img[contains(@src, "1x1")]', '//a[contains(@href, "creativecommons")]', + '//a[@href="#start-of-content"]', + '//ul[@id="article-tags"], ), ) ) ); + + diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/aljazeera.com.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/aljazeera.com.php new file mode 100644 index 000000000..105075605 --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/aljazeera.com.php @@ -0,0 +1,20 @@ +<?php +return array( + 'grabber' => array( + '%.*%' => array( + 'test_url' => 'http://www.aljazeera.com/news/2015/09/xi-jinping-seattle-china-150922230118373.html', + 'body' => array( + '//figure[@class="article-content"]', + '//div[@class="article-body"]', + ), + 'strip' => array( + '//h1', + '//h3', + '//ul', + '//a[@target="_self"]', + '//div[@data-embed-type="Brightcove"]', + '//div[@class="QuoteContainer"]' + ), + ) + ) +); diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/allafrica.com.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/allafrica.com.php new file mode 100644 index 000000000..bab3d44f4 --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/allafrica.com.php @@ -0,0 +1,19 @@ +<?php +return array( + 'grabber' => array( + '%.*%' => array( + 'test_url' => 'http://www.aljazeera.com/news/2015/09/xi-jinping-seattle-china-150922230118373.html', + 'body' => array( + '//div[@class="story-body"]', + ), + 'strip' => array( + '//p[@class="kindofstory"]', + '//cite[@class="byline"]', + '//div[contains(@class,"related-topics")]', + '//links', + '//sharebar', + '//related-topics', + ), + ) + ) +); diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/ap.org.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/ap.org.php new file mode 100644 index 000000000..1717ad5b4 --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/ap.org.php @@ -0,0 +1,13 @@ +<?php +return array( + 'grabber' => array( + '%.*%' => array( + 'test_url' => 'http://hosted.ap.org/dynamic/stories/A/AS_CHINA_GAO_ZHISHENG?SITE=AP&SECTION=HOME&TEMPLATE=DEFAULT', + 'body' => array( + '//img[@class="ap-smallphoto-img"]', + '//span[@class="entry-content"]', + ), + 'strip' => array(), + ) + ) +); diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/arstechnica.com.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/arstechnica.com.php new file mode 100644 index 000000000..d5e2de811 --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/arstechnica.com.php @@ -0,0 +1,17 @@ +<?php +return array( + 'grabber' => array( + '%.*%' => array( + 'test_url' => 'http://arstechnica.com/tech-policy/2015/09/judge-warners-2m-happy-birthday-copyright-is-bogus/', + 'body' => array( + '//section[@id="article-guts"]', + '//div[@class="superscroll-content show"]', + ), + 'strip' => array( + '//figcaption', + '//aside', + '//div[@class="article-expander"]', + ), + ) + ) +); diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/bangkokpost.com.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/bangkokpost.com.php new file mode 100644 index 000000000..20aed4a29 --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/bangkokpost.com.php @@ -0,0 +1,20 @@ +<?php +return array( + 'grabber' => array( + '%.*%' => array( + 'test_url' => 'http://www.bangkokpost.com/news/politics/704204/new-us-ambassador-arrives-in-bangkok', + 'body' => array( + '//div[@class="articleContents"]', + ), + 'strip' => array( + '//h2', + '//h4', + '//div[@class="text-size"]', + '//div[@class="relate-story"]', + '//div[@class="text-ads"]', + '//script', + '//ul', + ), + ) + ) +); diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/bgr.com.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/bgr.com.php new file mode 100644 index 000000000..ef62fa378 --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/bgr.com.php @@ -0,0 +1,15 @@ +<?php +return array( + 'grabber' => array( + '%.*%' => array( + 'test_url' => 'http://bgr.com/2015/09/27/iphone-6s-waterproof-testing/', + 'body' => array( + '//img[contains(@class,"img")]', + '//div[@class="text-column"]', + ), + 'strip' => array( + '//strong', + ), + ) + ) +); diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/bizjournals.com.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/bizjournals.com.php new file mode 100644 index 000000000..c6addb502 --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/bizjournals.com.php @@ -0,0 +1,13 @@ +<?php +return array( + 'grabber' => array( + '%.*%' => array( + 'test_url' => 'http://www.bizjournals.com/milwaukee/news/2015/09/30/bucks-will-hike-prices-on-best-seats-at-new-arena.html', + 'body' => array( + '//p[@class="media__caption"]', + '//figure/div/a/img', + '//p[@class="content__segment"]', + ), + ) + ) +); diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/buenosairesherald.com.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/buenosairesherald.com.php new file mode 100644 index 000000000..23dc2f73d --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/buenosairesherald.com.php @@ -0,0 +1,18 @@ +<?php +return array( + 'grabber' => array( + '%.*%' => array( + 'test_url' => 'http://www.buenosairesherald.com/article/199344/manzur-named-next-governor-of-tucum%C3%A1n', + 'body' => array( + '//div[@class="img_despliege"]', + '//div[@id="nota_despliegue"]', + ), + 'strip' => array( + '//script', + '//span[@id="fecha"]', + '//h1', + '//div[@class="autor"]', + ), + ) + ) +); diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/cnet.com.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/cnet.com.php new file mode 100644 index 000000000..a8db47ba3 --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/cnet.com.php @@ -0,0 +1,20 @@ +<?php +return array( + 'grabber' => array( + '%.*%' => array( + 'test_url' => 'http://cnet.com.feedsportal.com/c/34938/f/645093/s/4a340866/sc/28/l/0L0Scnet0N0Cnews0Cman0Eclaims0Eonline0Epsychic0Emade0Ehim0Ebuy0E10Emillion0Epowerball0Ewinning0Eticket0C0Tftag0FCAD590Aa51e/story01.htm', + 'body' => array( + '//p[@itemprop="description"]', + '//div[@itemprop="articleBody"]', + ), + 'strip' => array( + '//script', + '//a[@class="clickToEnlarge"]', + '//div[@section="topSharebar"]', + '//div[contains(@class,"related")]', + '//div[contains(@class,"ad-")]', + '//div[@section="shortcodeGallery"]', + ), + ) + ) +); diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/csmonitor.com.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/csmonitor.com.php new file mode 100644 index 000000000..7c44e3a52 --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/csmonitor.com.php @@ -0,0 +1,18 @@ +<?php +return array( + 'grabber' => array( + '%.*%' => array( + 'test_url' => 'http://www.csmonitor.com/USA/Politics/2015/0925/John-Boehner-steps-down-Self-sacrificing-but-will-it-lead-to-better-government', + 'body' => array( + '//figure[@id="image-top-1"]', + '//div[@id="story-body"]', + ), + 'strip' => array( + '//script', + '//img[@title="hide caption"]', + '//*[contains(@class,"promo_link")]', + '//div[@id="story-embed-column"]', + ), + ) + ) +); diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/dailytech.com.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/dailytech.com.php new file mode 100644 index 000000000..432f2b469 --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/dailytech.com.php @@ -0,0 +1,13 @@ +<?php +return array( + 'grabber' => array( + '%.*%' => array( + 'test_url' => 'http://www.dailytech.com/Apples+First+Fixes+to+iOS+9+Land+w+iOS++901+Release/article37495.htm', + 'body' => array( + '//div[@class="NewsBodyImage"]', + '//span[@id="lblSummary"]', + '//span[@id="lblBody"]', + ), + ) + ) +); diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/discovermagazine.com.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/discovermagazine.com.php new file mode 100644 index 000000000..a081acf93 --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/discovermagazine.com.php @@ -0,0 +1,17 @@ +<?php +return array( + 'grabber' => array( + '%.*%' => array( + 'test_url' => 'http://blogs.discovermagazine.com/the-extremo-files/2015/09/11/have-scientists-found-the-worlds-deepest-fish/', + 'body' => array( + '//div[@class="entry"]', + ), + 'strip' => array( + '//h1', + '//div[@class="meta"]', + '//div[@class="shareIcons"]', + '//div[@class="navigation"]', + ), + ) + ) +); diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/espn.go.com.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/espn.go.com.php new file mode 100644 index 000000000..5980d1b0a --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/espn.go.com.php @@ -0,0 +1,11 @@ +<?php +return array( + 'grabber' => array( + '%.*%' => array( + 'test_url' => 'http://espn.go.com/nfl/story/_/id/13388208/jason-whitlock-chip-kelly-controversy', + 'body' => array( + '//p', + ), + ) + ) +); diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/geek.com.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/geek.com.php new file mode 100644 index 000000000..cef956299 --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/geek.com.php @@ -0,0 +1,16 @@ +<?php +return array( + 'grabber' => array( + '%.*%' => array( + 'test_url' => 'http://www.geek.com/news/the-11-best-ways-to-eat-eggs-1634076/', + 'body' => array( + '//div[@class="articleinfo"]/figure', + '//div[@class="articleinfo"]/article', + '//span[@class="by"]', + ), + 'strip' => array( + '//span[@class="red"]', + ), + ) + ) +); diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/japantimes.co.jp.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/japantimes.co.jp.php new file mode 100644 index 000000000..50e6c479b --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/japantimes.co.jp.php @@ -0,0 +1,21 @@ +<?php +return array( + 'grabber' => array( + '%.*%' => array( + 'test_url' => 'http://www.japantimes.co.jp/news/2015/09/27/world/social-issues-world/pope-meets-sex-abuse-victims-philadelphia-promises-accountability/', + 'body' => array( + '//article[@role="main"]', + ), + 'strip' => array( + '//script', + '//header', + '//div[contains(@class, "meta")]', + '//div[@class="clearfix"]', + '//div[@class="OUTBRAIN"]', + '//ul[@id="content_footer_menu"]', + '//div[@class="article_footer_ad"]', + '//div[@id="disqus_thread"]', + ), + ) + ) +); diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/japantoday.com.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/japantoday.com.php new file mode 100644 index 000000000..4e5a6a43d --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/japantoday.com.php @@ -0,0 +1,15 @@ +<?php +return array( + 'grabber' => array( + '%.*%' => array( + 'test_url' => 'http://www.japantoday.com/category/politics/view/japan-u-s-to-sign-new-base-environment-pact', + 'body' => array( + '//div[@id="article_container"]', + ), + 'strip' => array( + '//h2', + '//div[@id="article_info"]', + ), + ) + ) +); diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/jsonline.com.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/jsonline.com.php new file mode 100644 index 000000000..8b35c4f5e --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/jsonline.com.php @@ -0,0 +1,27 @@ +<?php +return array( + 'grabber' => array( + '%.*%' => array( + 'test_url' => 'http://www.jsonline.com/news/usandworld/as-many-as-a-million-expected-for-popes-last-mass-in-us-b99585180z1-329688131.html', + 'body' => array( + '//div[@id="article"]', + '//div[@id="mainContent"]', + ), + 'strip' => array( + '//div[@class="storyTimestamp"]', + '//img[@class="floatLeft"]', + '//div[@class="overlineUpper"]', + '//div[@class="updated"]', + '//div[@class="columnist_link"]', + '//div[@class="side_container_01"]', + '//div[@class="credit"]', + '//h1', + '//h2', + '//h4', + '//ul', + '//div[contains(@class, "footer-pkg")]', + '//img[contains(@src,"analytics")]', + ), + ) + ) +); diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/koreaherald.com.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/koreaherald.com.php new file mode 100644 index 000000000..1e0cc8de0 --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/koreaherald.com.php @@ -0,0 +1,11 @@ +<?php +return array( + 'grabber' => array( + '%.*%' => array( + 'test_url' => 'http://www.koreaherald.com/view.php?ud=20150926000018', + 'body' => array( + '//div[@class="content_view"]', + ), + ) + ) +); diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/linux.org.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/linux.org.php new file mode 100644 index 000000000..d9d7e43ed --- /dev/null +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/linux.org.php @@ -0,0 +1,14 @@ +<?php +return array( + 'grabber' => array( + '%.*%' => array( + 'test_url' => 'http://www.linux.org/threads/lua-the-scripting-interpreter.8352/', + ' |