Rss-Bridge/bridges/NextInpactBridge.php

185 lines
5.4 KiB
PHP
Raw Normal View History

<?php
class NextInpactBridge extends FeedExpander {
const MAINTAINER = 'qwertygc and ORelio';
bridges: Fix coding styles This commit is a squash of all commits that fix coding styles for the new coding style policy. [ABCTabsBridge] Fix coding style [AcrimedBridge] Fix coding style [AllocineFRBridge] Fix coding style [AnimeUltimeBridge] Fix coding style [Arte7Bridge] Fix coding style [AskfmBridge] Fix coding style [BandcampBridge] Fix coding style [BastaBridge] Fix coding style [BlaguesDeMerdeBridge] Fix coding style [BooruprojectBridge] Fix coding style [CADBridge] Fix coding style [CNETBridge] Fix coding style [CastorusBridge] Fix coding style [CollegeDeFranceBridge] Fix coding style [CommonDreamsBridge] Fix coding style [CopieDoubleBridge] Fix coding style [CourrierInternationalBridge] Fix coding style [CpasbienBridge] Fix coding style [CryptomeBridge] Fix coding style [DailymotionBridge] Fix coding style [DanbooruBridge] Fix coding style [DansTonChatBridge] Fix coding style [DauphineLibereBridge] Fix coding style [DeveloppezDotComBridge] Fix coding style [DemoBridge] Fix coding style [DilbertBridge] Fix coding style [DuckDuckGoBridge] Fix coding style [DollbooruBridge] Fix coding style [EliteDangerousGalnetBridge] Fix coding style [ElsevierBridge] Fix coding style [EstCeQuonMetEnProdBridge] Fix coding style [EZTVBridge] Fix coding style [FacebookBridge] Fix coding style [FeedExpanderExampleBridge] Fix coding style [FB2Bridge] Fix coding style [FierPandaBridge] Fix coding style [FlickrBridge] Fix coding style [FootitoBridge] Fix coding style [FourchanBridge] Fix coding style [FuturaSciencesBridge] Fix coding style [GBAtempBridge] Fix coding style [GelbooruBridge] Fix coding style [GiphyBridge] Fix coding style [GithubIssueBridge] Fix coding style [GizmodoBridge] Fix coding style [GoComicsBridge] Fix coding style [GooglePlusPostBridge] Fix coding style [GoogleSearchBridge] Fix coding style [HDWallpapersBridge] Fix coding style [HentaiHavenBridge] Fix coding style [IdenticaBridge] Fix coding style [InstagramBridge] Fix coding style [IsoHuntBridge] Fix coding style [JapanExpoBridge] Fix coding style [KonachanBridge] Fix coding style [KoreusBridge] Fix coding style [KununuBridge] Fix coding style [LeBonCoinBridge] Fix coding style [LegifranceJOBBridge] Fix coding style [LeMondeInformatiqueBridge] Fix coding style [LesJoiesDuCodeBridge] Fix coding style [LichessBridge] Fix coding style [LinkedInCompanyBridge] Fix coding style [LolibooruBridge] Fix coding style [LWNprevBridge] Fix coding style [MangareaderBridge] Fix coding style [MilbooruBridge] Fix coding style [MixCloudBridge] Fix coding style [MoebooruBridge] Fix coding style [MondeDiploBridge] Fix coding style [MsnMondeBridge] Fix coding style [MspabooruBridge] Fix coding style [NasaApodBridge] Fix coding style [NeuviemeArtBridge] Fix coding style [NextgovBridge] Fix coding style [NextInpactBridge] Fix coding style [NiceMatinBridge] Fix coding style [NovelUpdatesBridge] Fix coding style [OpenClassroomsBridge] Fix coding style [ParuVenduImmoBridge] Fix coding style [PickyWallpapersBridge] Fix coding style [PinterestBridge] Fix coding style [PlanetLibreBridge] Fix coding style [ReadComicsBridge] Fix coding style [Releases3DSBridge] Fix coding style [ReporterreBridge] Fix coding style [RTBFBridge] Fix coding style [Rue89Bridge] Fix coding style [Rule34Bridge] Fix coding style [Rule34pahealBridge] Fix coding style [SafebooruBridge] Fix coding style [SakugabooruBridge] Fix coding style [ScmbBridge] Fix coding style [ScoopItBridge] Fix coding style [SensCritiqueBridge] Fix coding style [SexactuBridge] Fix coding style [ShanaprojectBridge] Fix coding style [Shimmie2Bridge] Fix coding style [SoundcloudBridge] Fix coding style [StripeAPIChangeLogBridge] Fix coding style [SuperbWallpapersBridge] Fix coding style [T411Bridge] Fix coding style [TagBoardBridge] Fix coding style [TbibBridge] Fix coding style [TheCodingLoveBridge] Fix coding style [TheHackerNewsBridge] Fix coding style [ThePirateBayBridge] Fix coding style [TheTVDBBridge] Fix coding style [Torrent9Bridge] Fix coding style [TwitterBridge] Fix coding style [UnsplashBridge] Fix coding style [ViadeoCompanyBridge] Fix coding style [VineBridge] Fix coding style [VkBridge] Fix coding style [WallpaperStopBridge] Fix coding style [WebfailBridge] Fix coding style [WeLiveSecurityBridge] Fix coding style [WhydBridge] Fix coding style [WikipediaBridge] Fix coding style [WordPressBridge] Fix coding style [WorldOfTanksBridge] Fix coding style [XbooruBridge] Fix coding style [YandereBridge] Fix coding style [YoutubeBridge] Fix coding style [ZDNetBridge] Fix coding style
2017-02-11 16:16:56 +01:00
const NAME = 'NextInpact Bridge';
const URI = 'https://www.nextinpact.com/';
const URI_HARDWARE = 'https://www.inpact-hardware.com/';
bridges: Fix coding styles This commit is a squash of all commits that fix coding styles for the new coding style policy. [ABCTabsBridge] Fix coding style [AcrimedBridge] Fix coding style [AllocineFRBridge] Fix coding style [AnimeUltimeBridge] Fix coding style [Arte7Bridge] Fix coding style [AskfmBridge] Fix coding style [BandcampBridge] Fix coding style [BastaBridge] Fix coding style [BlaguesDeMerdeBridge] Fix coding style [BooruprojectBridge] Fix coding style [CADBridge] Fix coding style [CNETBridge] Fix coding style [CastorusBridge] Fix coding style [CollegeDeFranceBridge] Fix coding style [CommonDreamsBridge] Fix coding style [CopieDoubleBridge] Fix coding style [CourrierInternationalBridge] Fix coding style [CpasbienBridge] Fix coding style [CryptomeBridge] Fix coding style [DailymotionBridge] Fix coding style [DanbooruBridge] Fix coding style [DansTonChatBridge] Fix coding style [DauphineLibereBridge] Fix coding style [DeveloppezDotComBridge] Fix coding style [DemoBridge] Fix coding style [DilbertBridge] Fix coding style [DuckDuckGoBridge] Fix coding style [DollbooruBridge] Fix coding style [EliteDangerousGalnetBridge] Fix coding style [ElsevierBridge] Fix coding style [EstCeQuonMetEnProdBridge] Fix coding style [EZTVBridge] Fix coding style [FacebookBridge] Fix coding style [FeedExpanderExampleBridge] Fix coding style [FB2Bridge] Fix coding style [FierPandaBridge] Fix coding style [FlickrBridge] Fix coding style [FootitoBridge] Fix coding style [FourchanBridge] Fix coding style [FuturaSciencesBridge] Fix coding style [GBAtempBridge] Fix coding style [GelbooruBridge] Fix coding style [GiphyBridge] Fix coding style [GithubIssueBridge] Fix coding style [GizmodoBridge] Fix coding style [GoComicsBridge] Fix coding style [GooglePlusPostBridge] Fix coding style [GoogleSearchBridge] Fix coding style [HDWallpapersBridge] Fix coding style [HentaiHavenBridge] Fix coding style [IdenticaBridge] Fix coding style [InstagramBridge] Fix coding style [IsoHuntBridge] Fix coding style [JapanExpoBridge] Fix coding style [KonachanBridge] Fix coding style [KoreusBridge] Fix coding style [KununuBridge] Fix coding style [LeBonCoinBridge] Fix coding style [LegifranceJOBBridge] Fix coding style [LeMondeInformatiqueBridge] Fix coding style [LesJoiesDuCodeBridge] Fix coding style [LichessBridge] Fix coding style [LinkedInCompanyBridge] Fix coding style [LolibooruBridge] Fix coding style [LWNprevBridge] Fix coding style [MangareaderBridge] Fix coding style [MilbooruBridge] Fix coding style [MixCloudBridge] Fix coding style [MoebooruBridge] Fix coding style [MondeDiploBridge] Fix coding style [MsnMondeBridge] Fix coding style [MspabooruBridge] Fix coding style [NasaApodBridge] Fix coding style [NeuviemeArtBridge] Fix coding style [NextgovBridge] Fix coding style [NextInpactBridge] Fix coding style [NiceMatinBridge] Fix coding style [NovelUpdatesBridge] Fix coding style [OpenClassroomsBridge] Fix coding style [ParuVenduImmoBridge] Fix coding style [PickyWallpapersBridge] Fix coding style [PinterestBridge] Fix coding style [PlanetLibreBridge] Fix coding style [ReadComicsBridge] Fix coding style [Releases3DSBridge] Fix coding style [ReporterreBridge] Fix coding style [RTBFBridge] Fix coding style [Rue89Bridge] Fix coding style [Rule34Bridge] Fix coding style [Rule34pahealBridge] Fix coding style [SafebooruBridge] Fix coding style [SakugabooruBridge] Fix coding style [ScmbBridge] Fix coding style [ScoopItBridge] Fix coding style [SensCritiqueBridge] Fix coding style [SexactuBridge] Fix coding style [ShanaprojectBridge] Fix coding style [Shimmie2Bridge] Fix coding style [SoundcloudBridge] Fix coding style [StripeAPIChangeLogBridge] Fix coding style [SuperbWallpapersBridge] Fix coding style [T411Bridge] Fix coding style [TagBoardBridge] Fix coding style [TbibBridge] Fix coding style [TheCodingLoveBridge] Fix coding style [TheHackerNewsBridge] Fix coding style [ThePirateBayBridge] Fix coding style [TheTVDBBridge] Fix coding style [Torrent9Bridge] Fix coding style [TwitterBridge] Fix coding style [UnsplashBridge] Fix coding style [ViadeoCompanyBridge] Fix coding style [VineBridge] Fix coding style [VkBridge] Fix coding style [WallpaperStopBridge] Fix coding style [WebfailBridge] Fix coding style [WeLiveSecurityBridge] Fix coding style [WhydBridge] Fix coding style [WikipediaBridge] Fix coding style [WordPressBridge] Fix coding style [WorldOfTanksBridge] Fix coding style [XbooruBridge] Fix coding style [YandereBridge] Fix coding style [YoutubeBridge] Fix coding style [ZDNetBridge] Fix coding style
2017-02-11 16:16:56 +01:00
const DESCRIPTION = 'Returns the newest articles.';
2015-11-04 10:47:21 +01:00
Catching up | [Main] Debug mode, parse utils, MIME | [Bridges] Add/Improve 20 bridges (#802) * Debug mode improvements - Improve debug warning message - Restore error reporting in debug mode - Fix 'notice' messages for unset fields * Add parsing utility functions html.php - extractFromDelimiters - stripWithDelimiters - stripRecursiveHTMLSection - markdownToHtml (partial) bridges - remove now-duplicate functions - call functions from html.php instead * [Anidex] New bridge Anime torrent tracker * [Anime-Ultime] Restore thumbnail * [CNET] Recreate bridge Full rewrite as the previous one was broken * [Dilbert] Minor URI fix Use new self::URI property * [EstCeQuonMetEnProd] Fix content extraction Bridge was broken * [Facebook] Fix "SpSonsSoriSsés" label ... which was taking space in item title * [Futura-Sciences] Use HTTPS, More cleanup Use HTTPS as FS now offer HTTPS Clean additional useless HTML elements * [GBATemp] Multiple fixes - Fix categories: missing "break" statements - Restore thumbnail as enclosure - Fix date extraction - Fix user blog post extraction - Use getSimpleHTMLDOMCached * [JapanExpo] Fix bridge, HTTPS, thumbnails - Fix getSimpleHTMLDOMCached call - Upgrade to HTTPS as JE now offers HTTPS - Restore thumbnails as enclosures * [LeMondeInformatique] Fix bridge, HTTPS - Upgrade to HTTPS as LMI now offers HTTPS - Restore thumbnails using small images - Fix content extraction - Fix text encoding issue * [Nextgov] Fix content extraction - Restore thumbnail and use small image - Field extraction fixes * [NextInpact] Add categories and filtering by type - Offer all RSS feeds - Allow filtering by article type - Implement extraction for brief articles - Remove article limit, many brief articles are publied all at once * [NyaaTorrents] New bridge Anime torrent tracker * [Releases3DS] Cache content, restore thumbnail - Use getSimpleHTMLDOMCached - Restore thumbnail as enclosure * [TheHackerNews] Fix bridge - Fix content extraction including article body - Restore thumbnail as enclosure * [WeLiveSecurity] HTTPS, Fix content extraction - Upgrade to HTTPS as WLS now offers HTTPS - Fix content extraction including article body * [WordPress] Reduce timeout, more content selectors - Reduce timeout to use default one (1h) - Add new content selector (articleBody) - Find thumbnail and set as enclosure - Fix <script> cleanup * [YGGTorrent] Increase limit, use cache - Increase item limit as uploads are very frequent - Use getSimpleHTMLDOMCached * [ZDNet] Rewrite with FeedExpander - Upgrade to HTTPS as ZD now offers HTTPS - Use FeedExpander for secondary fields - Fix content extraction for article body * [Main] Handle MIME type for enclosures Many feed readers will ignore enclosures (e.g. thumbnails) with no MIME type. This commit adds automatic MIME type detection based on file extension (which may be inaccurate but is the only way without fetching the content). One can force enclosure type using #.ext anchor (hacky, needs improving) * [FeedExpander] Improve field extraction - Add support for passing enclosures - Improve author and uri extraction - Fix 'notice' PHP error messages * [Pull] Coding style fixes for #802 * [Pull] Implementing changes for #802 - Fix coding style issues with str append - Remove useless CACHE_TIMEOUT - Use count() instead of $limit - Use defaultLinkTo() + handle strings - Use http_build_query() - Fix missing </em> - Remove error_reporting(0) - warning CSS (@LogMANOriginal) - Fix typo in FeedExpander comment * [Main] More documentation for markdownToHtml See #802 for more details
2018-09-09 21:20:13 +02:00
const PARAMETERS = array( array(
'feed' => array(
'name' => 'Feed',
'type' => 'list',
'values' => array(
'Nos actualités' => array(
'Toutes nos publications' => 'news',
'Toutes nos publications sauf #LeBrief' => 'nobrief',
'Toutes nos publications sauf INpact Hardware' => 'noih',
'Seulement les publications INpact Hardware' => 'hardware:news',
'Seulement les publications Next INpact' => 'nobrief-noih',
'Seulement les publications #LeBrief' => 'lebrief',
),
'Flux spécifiques' => array(
'Le blog' => 'blog',
'Les bons plans' => 'bonsplans',
'Publications INpact Hardware en accès libre' => 'hardware:acces-libre',
'Publications Next INpact en accès libre' => 'acces-libre',
),
'Flux thématiques' => array(
'Tech' => 'category:1',
'Logiciel' => 'category:2',
'Internet' => 'category:3',
'Mobilité' => 'category:4',
'Droit' => 'category:5',
'Économie' => 'category:6',
'Culture numérique' => 'category:7',
'Next INpact' => 'category:8',
)
Catching up | [Main] Debug mode, parse utils, MIME | [Bridges] Add/Improve 20 bridges (#802) * Debug mode improvements - Improve debug warning message - Restore error reporting in debug mode - Fix 'notice' messages for unset fields * Add parsing utility functions html.php - extractFromDelimiters - stripWithDelimiters - stripRecursiveHTMLSection - markdownToHtml (partial) bridges - remove now-duplicate functions - call functions from html.php instead * [Anidex] New bridge Anime torrent tracker * [Anime-Ultime] Restore thumbnail * [CNET] Recreate bridge Full rewrite as the previous one was broken * [Dilbert] Minor URI fix Use new self::URI property * [EstCeQuonMetEnProd] Fix content extraction Bridge was broken * [Facebook] Fix "SpSonsSoriSsés" label ... which was taking space in item title * [Futura-Sciences] Use HTTPS, More cleanup Use HTTPS as FS now offer HTTPS Clean additional useless HTML elements * [GBATemp] Multiple fixes - Fix categories: missing "break" statements - Restore thumbnail as enclosure - Fix date extraction - Fix user blog post extraction - Use getSimpleHTMLDOMCached * [JapanExpo] Fix bridge, HTTPS, thumbnails - Fix getSimpleHTMLDOMCached call - Upgrade to HTTPS as JE now offers HTTPS - Restore thumbnails as enclosures * [LeMondeInformatique] Fix bridge, HTTPS - Upgrade to HTTPS as LMI now offers HTTPS - Restore thumbnails using small images - Fix content extraction - Fix text encoding issue * [Nextgov] Fix content extraction - Restore thumbnail and use small image - Field extraction fixes * [NextInpact] Add categories and filtering by type - Offer all RSS feeds - Allow filtering by article type - Implement extraction for brief articles - Remove article limit, many brief articles are publied all at once * [NyaaTorrents] New bridge Anime torrent tracker * [Releases3DS] Cache content, restore thumbnail - Use getSimpleHTMLDOMCached - Restore thumbnail as enclosure * [TheHackerNews] Fix bridge - Fix content extraction including article body - Restore thumbnail as enclosure * [WeLiveSecurity] HTTPS, Fix content extraction - Upgrade to HTTPS as WLS now offers HTTPS - Fix content extraction including article body * [WordPress] Reduce timeout, more content selectors - Reduce timeout to use default one (1h) - Add new content selector (articleBody) - Find thumbnail and set as enclosure - Fix <script> cleanup * [YGGTorrent] Increase limit, use cache - Increase item limit as uploads are very frequent - Use getSimpleHTMLDOMCached * [ZDNet] Rewrite with FeedExpander - Upgrade to HTTPS as ZD now offers HTTPS - Use FeedExpander for secondary fields - Fix content extraction for article body * [Main] Handle MIME type for enclosures Many feed readers will ignore enclosures (e.g. thumbnails) with no MIME type. This commit adds automatic MIME type detection based on file extension (which may be inaccurate but is the only way without fetching the content). One can force enclosure type using #.ext anchor (hacky, needs improving) * [FeedExpander] Improve field extraction - Add support for passing enclosures - Improve author and uri extraction - Fix 'notice' PHP error messages * [Pull] Coding style fixes for #802 * [Pull] Implementing changes for #802 - Fix coding style issues with str append - Remove useless CACHE_TIMEOUT - Use count() instead of $limit - Use defaultLinkTo() + handle strings - Use http_build_query() - Fix missing </em> - Remove error_reporting(0) - warning CSS (@LogMANOriginal) - Fix typo in FeedExpander comment * [Main] More documentation for markdownToHtml See #802 for more details
2018-09-09 21:20:13 +02:00
)
),
'filter_premium' => array(
'name' => 'Premium',
'type' => 'list',
'values' => array(
'No filter' => '0',
'Hide Premium' => '1',
'Only Premium' => '2'
)
),
'filter_brief' => array(
'name' => 'Brief',
'type' => 'list',
'values' => array(
'No filter' => '0',
'Hide Brief' => '1',
'Only Brief' => '2'
)
)
));
public function collectData(){
Catching up | [Main] Debug mode, parse utils, MIME | [Bridges] Add/Improve 20 bridges (#802) * Debug mode improvements - Improve debug warning message - Restore error reporting in debug mode - Fix 'notice' messages for unset fields * Add parsing utility functions html.php - extractFromDelimiters - stripWithDelimiters - stripRecursiveHTMLSection - markdownToHtml (partial) bridges - remove now-duplicate functions - call functions from html.php instead * [Anidex] New bridge Anime torrent tracker * [Anime-Ultime] Restore thumbnail * [CNET] Recreate bridge Full rewrite as the previous one was broken * [Dilbert] Minor URI fix Use new self::URI property * [EstCeQuonMetEnProd] Fix content extraction Bridge was broken * [Facebook] Fix "SpSonsSoriSsés" label ... which was taking space in item title * [Futura-Sciences] Use HTTPS, More cleanup Use HTTPS as FS now offer HTTPS Clean additional useless HTML elements * [GBATemp] Multiple fixes - Fix categories: missing "break" statements - Restore thumbnail as enclosure - Fix date extraction - Fix user blog post extraction - Use getSimpleHTMLDOMCached * [JapanExpo] Fix bridge, HTTPS, thumbnails - Fix getSimpleHTMLDOMCached call - Upgrade to HTTPS as JE now offers HTTPS - Restore thumbnails as enclosures * [LeMondeInformatique] Fix bridge, HTTPS - Upgrade to HTTPS as LMI now offers HTTPS - Restore thumbnails using small images - Fix content extraction - Fix text encoding issue * [Nextgov] Fix content extraction - Restore thumbnail and use small image - Field extraction fixes * [NextInpact] Add categories and filtering by type - Offer all RSS feeds - Allow filtering by article type - Implement extraction for brief articles - Remove article limit, many brief articles are publied all at once * [NyaaTorrents] New bridge Anime torrent tracker * [Releases3DS] Cache content, restore thumbnail - Use getSimpleHTMLDOMCached - Restore thumbnail as enclosure * [TheHackerNews] Fix bridge - Fix content extraction including article body - Restore thumbnail as enclosure * [WeLiveSecurity] HTTPS, Fix content extraction - Upgrade to HTTPS as WLS now offers HTTPS - Fix content extraction including article body * [WordPress] Reduce timeout, more content selectors - Reduce timeout to use default one (1h) - Add new content selector (articleBody) - Find thumbnail and set as enclosure - Fix <script> cleanup * [YGGTorrent] Increase limit, use cache - Increase item limit as uploads are very frequent - Use getSimpleHTMLDOMCached * [ZDNet] Rewrite with FeedExpander - Upgrade to HTTPS as ZD now offers HTTPS - Use FeedExpander for secondary fields - Fix content extraction for article body * [Main] Handle MIME type for enclosures Many feed readers will ignore enclosures (e.g. thumbnails) with no MIME type. This commit adds automatic MIME type detection based on file extension (which may be inaccurate but is the only way without fetching the content). One can force enclosure type using #.ext anchor (hacky, needs improving) * [FeedExpander] Improve field extraction - Add support for passing enclosures - Improve author and uri extraction - Fix 'notice' PHP error messages * [Pull] Coding style fixes for #802 * [Pull] Implementing changes for #802 - Fix coding style issues with str append - Remove useless CACHE_TIMEOUT - Use count() instead of $limit - Use defaultLinkTo() + handle strings - Use http_build_query() - Fix missing </em> - Remove error_reporting(0) - warning CSS (@LogMANOriginal) - Fix typo in FeedExpander comment * [Main] More documentation for markdownToHtml See #802 for more details
2018-09-09 21:20:13 +02:00
$feed = $this->getInput('feed');
$base_uri = self::URI;
$args = '';
if (empty($feed)) {
// Default to All articles
Catching up | [Main] Debug mode, parse utils, MIME | [Bridges] Add/Improve 20 bridges (#802) * Debug mode improvements - Improve debug warning message - Restore error reporting in debug mode - Fix 'notice' messages for unset fields * Add parsing utility functions html.php - extractFromDelimiters - stripWithDelimiters - stripRecursiveHTMLSection - markdownToHtml (partial) bridges - remove now-duplicate functions - call functions from html.php instead * [Anidex] New bridge Anime torrent tracker * [Anime-Ultime] Restore thumbnail * [CNET] Recreate bridge Full rewrite as the previous one was broken * [Dilbert] Minor URI fix Use new self::URI property * [EstCeQuonMetEnProd] Fix content extraction Bridge was broken * [Facebook] Fix "SpSonsSoriSsés" label ... which was taking space in item title * [Futura-Sciences] Use HTTPS, More cleanup Use HTTPS as FS now offer HTTPS Clean additional useless HTML elements * [GBATemp] Multiple fixes - Fix categories: missing "break" statements - Restore thumbnail as enclosure - Fix date extraction - Fix user blog post extraction - Use getSimpleHTMLDOMCached * [JapanExpo] Fix bridge, HTTPS, thumbnails - Fix getSimpleHTMLDOMCached call - Upgrade to HTTPS as JE now offers HTTPS - Restore thumbnails as enclosures * [LeMondeInformatique] Fix bridge, HTTPS - Upgrade to HTTPS as LMI now offers HTTPS - Restore thumbnails using small images - Fix content extraction - Fix text encoding issue * [Nextgov] Fix content extraction - Restore thumbnail and use small image - Field extraction fixes * [NextInpact] Add categories and filtering by type - Offer all RSS feeds - Allow filtering by article type - Implement extraction for brief articles - Remove article limit, many brief articles are publied all at once * [NyaaTorrents] New bridge Anime torrent tracker * [Releases3DS] Cache content, restore thumbnail - Use getSimpleHTMLDOMCached - Restore thumbnail as enclosure * [TheHackerNews] Fix bridge - Fix content extraction including article body - Restore thumbnail as enclosure * [WeLiveSecurity] HTTPS, Fix content extraction - Upgrade to HTTPS as WLS now offers HTTPS - Fix content extraction including article body * [WordPress] Reduce timeout, more content selectors - Reduce timeout to use default one (1h) - Add new content selector (articleBody) - Find thumbnail and set as enclosure - Fix <script> cleanup * [YGGTorrent] Increase limit, use cache - Increase item limit as uploads are very frequent - Use getSimpleHTMLDOMCached * [ZDNet] Rewrite with FeedExpander - Upgrade to HTTPS as ZD now offers HTTPS - Use FeedExpander for secondary fields - Fix content extraction for article body * [Main] Handle MIME type for enclosures Many feed readers will ignore enclosures (e.g. thumbnails) with no MIME type. This commit adds automatic MIME type detection based on file extension (which may be inaccurate but is the only way without fetching the content). One can force enclosure type using #.ext anchor (hacky, needs improving) * [FeedExpander] Improve field extraction - Add support for passing enclosures - Improve author and uri extraction - Fix 'notice' PHP error messages * [Pull] Coding style fixes for #802 * [Pull] Implementing changes for #802 - Fix coding style issues with str append - Remove useless CACHE_TIMEOUT - Use count() instead of $limit - Use defaultLinkTo() + handle strings - Use http_build_query() - Fix missing </em> - Remove error_reporting(0) - warning CSS (@LogMANOriginal) - Fix typo in FeedExpander comment * [Main] More documentation for markdownToHtml See #802 for more details
2018-09-09 21:20:13 +02:00
$feed = 'news';
}
if (strpos($feed, 'hardware:') === 0) {
// Feed hosted on Hardware domain
$base_uri = self::URI_HARDWARE;
$feed = str_replace('hardware:', '', $feed);
}
if (strpos($feed, 'category:') === 0) {
// Feed with specific category parameter
$args = '?CategoryIds=' . str_replace('category:', '', $feed);
$feed = 'params';
}
$this->collectExpandableDatas($base_uri . 'rss/' . $feed . '.xml' . $args);
}
protected function parseItem($newsItem){
$item = parent::parseItem($newsItem);
Catching up | [Main] Debug mode, parse utils, MIME | [Bridges] Add/Improve 20 bridges (#802) * Debug mode improvements - Improve debug warning message - Restore error reporting in debug mode - Fix 'notice' messages for unset fields * Add parsing utility functions html.php - extractFromDelimiters - stripWithDelimiters - stripRecursiveHTMLSection - markdownToHtml (partial) bridges - remove now-duplicate functions - call functions from html.php instead * [Anidex] New bridge Anime torrent tracker * [Anime-Ultime] Restore thumbnail * [CNET] Recreate bridge Full rewrite as the previous one was broken * [Dilbert] Minor URI fix Use new self::URI property * [EstCeQuonMetEnProd] Fix content extraction Bridge was broken * [Facebook] Fix "SpSonsSoriSsés" label ... which was taking space in item title * [Futura-Sciences] Use HTTPS, More cleanup Use HTTPS as FS now offer HTTPS Clean additional useless HTML elements * [GBATemp] Multiple fixes - Fix categories: missing "break" statements - Restore thumbnail as enclosure - Fix date extraction - Fix user blog post extraction - Use getSimpleHTMLDOMCached * [JapanExpo] Fix bridge, HTTPS, thumbnails - Fix getSimpleHTMLDOMCached call - Upgrade to HTTPS as JE now offers HTTPS - Restore thumbnails as enclosures * [LeMondeInformatique] Fix bridge, HTTPS - Upgrade to HTTPS as LMI now offers HTTPS - Restore thumbnails using small images - Fix content extraction - Fix text encoding issue * [Nextgov] Fix content extraction - Restore thumbnail and use small image - Field extraction fixes * [NextInpact] Add categories and filtering by type - Offer all RSS feeds - Allow filtering by article type - Implement extraction for brief articles - Remove article limit, many brief articles are publied all at once * [NyaaTorrents] New bridge Anime torrent tracker * [Releases3DS] Cache content, restore thumbnail - Use getSimpleHTMLDOMCached - Restore thumbnail as enclosure * [TheHackerNews] Fix bridge - Fix content extraction including article body - Restore thumbnail as enclosure * [WeLiveSecurity] HTTPS, Fix content extraction - Upgrade to HTTPS as WLS now offers HTTPS - Fix content extraction including article body * [WordPress] Reduce timeout, more content selectors - Reduce timeout to use default one (1h) - Add new content selector (articleBody) - Find thumbnail and set as enclosure - Fix <script> cleanup * [YGGTorrent] Increase limit, use cache - Increase item limit as uploads are very frequent - Use getSimpleHTMLDOMCached * [ZDNet] Rewrite with FeedExpander - Upgrade to HTTPS as ZD now offers HTTPS - Use FeedExpander for secondary fields - Fix content extraction for article body * [Main] Handle MIME type for enclosures Many feed readers will ignore enclosures (e.g. thumbnails) with no MIME type. This commit adds automatic MIME type detection based on file extension (which may be inaccurate but is the only way without fetching the content). One can force enclosure type using #.ext anchor (hacky, needs improving) * [FeedExpander] Improve field extraction - Add support for passing enclosures - Improve author and uri extraction - Fix 'notice' PHP error messages * [Pull] Coding style fixes for #802 * [Pull] Implementing changes for #802 - Fix coding style issues with str append - Remove useless CACHE_TIMEOUT - Use count() instead of $limit - Use defaultLinkTo() + handle strings - Use http_build_query() - Fix missing </em> - Remove error_reporting(0) - warning CSS (@LogMANOriginal) - Fix typo in FeedExpander comment * [Main] More documentation for markdownToHtml See #802 for more details
2018-09-09 21:20:13 +02:00
$item['content'] = $this->extractContent($item, $item['uri']);
if (is_null($item['content']))
return null; //Filtered article
return $item;
}
Catching up | [Main] Debug mode, parse utils, MIME | [Bridges] Add/Improve 20 bridges (#802) * Debug mode improvements - Improve debug warning message - Restore error reporting in debug mode - Fix 'notice' messages for unset fields * Add parsing utility functions html.php - extractFromDelimiters - stripWithDelimiters - stripRecursiveHTMLSection - markdownToHtml (partial) bridges - remove now-duplicate functions - call functions from html.php instead * [Anidex] New bridge Anime torrent tracker * [Anime-Ultime] Restore thumbnail * [CNET] Recreate bridge Full rewrite as the previous one was broken * [Dilbert] Minor URI fix Use new self::URI property * [EstCeQuonMetEnProd] Fix content extraction Bridge was broken * [Facebook] Fix "SpSonsSoriSsés" label ... which was taking space in item title * [Futura-Sciences] Use HTTPS, More cleanup Use HTTPS as FS now offer HTTPS Clean additional useless HTML elements * [GBATemp] Multiple fixes - Fix categories: missing "break" statements - Restore thumbnail as enclosure - Fix date extraction - Fix user blog post extraction - Use getSimpleHTMLDOMCached * [JapanExpo] Fix bridge, HTTPS, thumbnails - Fix getSimpleHTMLDOMCached call - Upgrade to HTTPS as JE now offers HTTPS - Restore thumbnails as enclosures * [LeMondeInformatique] Fix bridge, HTTPS - Upgrade to HTTPS as LMI now offers HTTPS - Restore thumbnails using small images - Fix content extraction - Fix text encoding issue * [Nextgov] Fix content extraction - Restore thumbnail and use small image - Field extraction fixes * [NextInpact] Add categories and filtering by type - Offer all RSS feeds - Allow filtering by article type - Implement extraction for brief articles - Remove article limit, many brief articles are publied all at once * [NyaaTorrents] New bridge Anime torrent tracker * [Releases3DS] Cache content, restore thumbnail - Use getSimpleHTMLDOMCached - Restore thumbnail as enclosure * [TheHackerNews] Fix bridge - Fix content extraction including article body - Restore thumbnail as enclosure * [WeLiveSecurity] HTTPS, Fix content extraction - Upgrade to HTTPS as WLS now offers HTTPS - Fix content extraction including article body * [WordPress] Reduce timeout, more content selectors - Reduce timeout to use default one (1h) - Add new content selector (articleBody) - Find thumbnail and set as enclosure - Fix <script> cleanup * [YGGTorrent] Increase limit, use cache - Increase item limit as uploads are very frequent - Use getSimpleHTMLDOMCached * [ZDNet] Rewrite with FeedExpander - Upgrade to HTTPS as ZD now offers HTTPS - Use FeedExpander for secondary fields - Fix content extraction for article body * [Main] Handle MIME type for enclosures Many feed readers will ignore enclosures (e.g. thumbnails) with no MIME type. This commit adds automatic MIME type detection based on file extension (which may be inaccurate but is the only way without fetching the content). One can force enclosure type using #.ext anchor (hacky, needs improving) * [FeedExpander] Improve field extraction - Add support for passing enclosures - Improve author and uri extraction - Fix 'notice' PHP error messages * [Pull] Coding style fixes for #802 * [Pull] Implementing changes for #802 - Fix coding style issues with str append - Remove useless CACHE_TIMEOUT - Use count() instead of $limit - Use defaultLinkTo() + handle strings - Use http_build_query() - Fix missing </em> - Remove error_reporting(0) - warning CSS (@LogMANOriginal) - Fix typo in FeedExpander comment * [Main] More documentation for markdownToHtml See #802 for more details
2018-09-09 21:20:13 +02:00
private function extractContent($item, $url){
$html = getSimpleHTMLDOMCached($url);
if (!is_object($html))
return 'Failed to request NextInpact: ' . $url;
// Filter premium and brief articles?
$brief_selector = 'div.brief-container';
Catching up | [Main] Debug mode, parse utils, MIME | [Bridges] Add/Improve 20 bridges (#802) * Debug mode improvements - Improve debug warning message - Restore error reporting in debug mode - Fix 'notice' messages for unset fields * Add parsing utility functions html.php - extractFromDelimiters - stripWithDelimiters - stripRecursiveHTMLSection - markdownToHtml (partial) bridges - remove now-duplicate functions - call functions from html.php instead * [Anidex] New bridge Anime torrent tracker * [Anime-Ultime] Restore thumbnail * [CNET] Recreate bridge Full rewrite as the previous one was broken * [Dilbert] Minor URI fix Use new self::URI property * [EstCeQuonMetEnProd] Fix content extraction Bridge was broken * [Facebook] Fix "SpSonsSoriSsés" label ... which was taking space in item title * [Futura-Sciences] Use HTTPS, More cleanup Use HTTPS as FS now offer HTTPS Clean additional useless HTML elements * [GBATemp] Multiple fixes - Fix categories: missing "break" statements - Restore thumbnail as enclosure - Fix date extraction - Fix user blog post extraction - Use getSimpleHTMLDOMCached * [JapanExpo] Fix bridge, HTTPS, thumbnails - Fix getSimpleHTMLDOMCached call - Upgrade to HTTPS as JE now offers HTTPS - Restore thumbnails as enclosures * [LeMondeInformatique] Fix bridge, HTTPS - Upgrade to HTTPS as LMI now offers HTTPS - Restore thumbnails using small images - Fix content extraction - Fix text encoding issue * [Nextgov] Fix content extraction - Restore thumbnail and use small image - Field extraction fixes * [NextInpact] Add categories and filtering by type - Offer all RSS feeds - Allow filtering by article type - Implement extraction for brief articles - Remove article limit, many brief articles are publied all at once * [NyaaTorrents] New bridge Anime torrent tracker * [Releases3DS] Cache content, restore thumbnail - Use getSimpleHTMLDOMCached - Restore thumbnail as enclosure * [TheHackerNews] Fix bridge - Fix content extraction including article body - Restore thumbnail as enclosure * [WeLiveSecurity] HTTPS, Fix content extraction - Upgrade to HTTPS as WLS now offers HTTPS - Fix content extraction including article body * [WordPress] Reduce timeout, more content selectors - Reduce timeout to use default one (1h) - Add new content selector (articleBody) - Find thumbnail and set as enclosure - Fix <script> cleanup * [YGGTorrent] Increase limit, use cache - Increase item limit as uploads are very frequent - Use getSimpleHTMLDOMCached * [ZDNet] Rewrite with FeedExpander - Upgrade to HTTPS as ZD now offers HTTPS - Use FeedExpander for secondary fields - Fix content extraction for article body * [Main] Handle MIME type for enclosures Many feed readers will ignore enclosures (e.g. thumbnails) with no MIME type. This commit adds automatic MIME type detection based on file extension (which may be inaccurate but is the only way without fetching the content). One can force enclosure type using #.ext anchor (hacky, needs improving) * [FeedExpander] Improve field extraction - Add support for passing enclosures - Improve author and uri extraction - Fix 'notice' PHP error messages * [Pull] Coding style fixes for #802 * [Pull] Implementing changes for #802 - Fix coding style issues with str append - Remove useless CACHE_TIMEOUT - Use count() instead of $limit - Use defaultLinkTo() + handle strings - Use http_build_query() - Fix missing </em> - Remove error_reporting(0) - warning CSS (@LogMANOriginal) - Fix typo in FeedExpander comment * [Main] More documentation for markdownToHtml See #802 for more details
2018-09-09 21:20:13 +02:00
foreach(array(
'filter_premium' => 'p.red-msg',
'filter_brief' => $brief_selector
Catching up | [Main] Debug mode, parse utils, MIME | [Bridges] Add/Improve 20 bridges (#802) * Debug mode improvements - Improve debug warning message - Restore error reporting in debug mode - Fix 'notice' messages for unset fields * Add parsing utility functions html.php - extractFromDelimiters - stripWithDelimiters - stripRecursiveHTMLSection - markdownToHtml (partial) bridges - remove now-duplicate functions - call functions from html.php instead * [Anidex] New bridge Anime torrent tracker * [Anime-Ultime] Restore thumbnail * [CNET] Recreate bridge Full rewrite as the previous one was broken * [Dilbert] Minor URI fix Use new self::URI property * [EstCeQuonMetEnProd] Fix content extraction Bridge was broken * [Facebook] Fix "SpSonsSoriSsés" label ... which was taking space in item title * [Futura-Sciences] Use HTTPS, More cleanup Use HTTPS as FS now offer HTTPS Clean additional useless HTML elements * [GBATemp] Multiple fixes - Fix categories: missing "break" statements - Restore thumbnail as enclosure - Fix date extraction - Fix user blog post extraction - Use getSimpleHTMLDOMCached * [JapanExpo] Fix bridge, HTTPS, thumbnails - Fix getSimpleHTMLDOMCached call - Upgrade to HTTPS as JE now offers HTTPS - Restore thumbnails as enclosures * [LeMondeInformatique] Fix bridge, HTTPS - Upgrade to HTTPS as LMI now offers HTTPS - Restore thumbnails using small images - Fix content extraction - Fix text encoding issue * [Nextgov] Fix content extraction - Restore thumbnail and use small image - Field extraction fixes * [NextInpact] Add categories and filtering by type - Offer all RSS feeds - Allow filtering by article type - Implement extraction for brief articles - Remove article limit, many brief articles are publied all at once * [NyaaTorrents] New bridge Anime torrent tracker * [Releases3DS] Cache content, restore thumbnail - Use getSimpleHTMLDOMCached - Restore thumbnail as enclosure * [TheHackerNews] Fix bridge - Fix content extraction including article body - Restore thumbnail as enclosure * [WeLiveSecurity] HTTPS, Fix content extraction - Upgrade to HTTPS as WLS now offers HTTPS - Fix content extraction including article body * [WordPress] Reduce timeout, more content selectors - Reduce timeout to use default one (1h) - Add new content selector (articleBody) - Find thumbnail and set as enclosure - Fix <script> cleanup * [YGGTorrent] Increase limit, use cache - Increase item limit as uploads are very frequent - Use getSimpleHTMLDOMCached * [ZDNet] Rewrite with FeedExpander - Upgrade to HTTPS as ZD now offers HTTPS - Use FeedExpander for secondary fields - Fix content extraction for article body * [Main] Handle MIME type for enclosures Many feed readers will ignore enclosures (e.g. thumbnails) with no MIME type. This commit adds automatic MIME type detection based on file extension (which may be inaccurate but is the only way without fetching the content). One can force enclosure type using #.ext anchor (hacky, needs improving) * [FeedExpander] Improve field extraction - Add support for passing enclosures - Improve author and uri extraction - Fix 'notice' PHP error messages * [Pull] Coding style fixes for #802 * [Pull] Implementing changes for #802 - Fix coding style issues with str append - Remove useless CACHE_TIMEOUT - Use count() instead of $limit - Use defaultLinkTo() + handle strings - Use http_build_query() - Fix missing </em> - Remove error_reporting(0) - warning CSS (@LogMANOriginal) - Fix typo in FeedExpander comment * [Main] More documentation for markdownToHtml See #802 for more details
2018-09-09 21:20:13 +02:00
) as $param_name => $selector) {
$param_val = intval($this->getInput($param_name));
if ($param_val != 0) {
$element_present = is_object($html->find($selector, 0));
$element_wanted = ($param_val == 2);
if ($element_present != $element_wanted) {
return null; //Filter article
}
}
}
$article_content = $html->find('div.article-content', 0);
if (!is_object($article_content)) {
$article_content = $html->find('div.content', 0);
}
if (is_object($article_content)) {
Catching up | [Main] Debug mode, parse utils, MIME | [Bridges] Add/Improve 20 bridges (#802) * Debug mode improvements - Improve debug warning message - Restore error reporting in debug mode - Fix 'notice' messages for unset fields * Add parsing utility functions html.php - extractFromDelimiters - stripWithDelimiters - stripRecursiveHTMLSection - markdownToHtml (partial) bridges - remove now-duplicate functions - call functions from html.php instead * [Anidex] New bridge Anime torrent tracker * [Anime-Ultime] Restore thumbnail * [CNET] Recreate bridge Full rewrite as the previous one was broken * [Dilbert] Minor URI fix Use new self::URI property * [EstCeQuonMetEnProd] Fix content extraction Bridge was broken * [Facebook] Fix "SpSonsSoriSsés" label ... which was taking space in item title * [Futura-Sciences] Use HTTPS, More cleanup Use HTTPS as FS now offer HTTPS Clean additional useless HTML elements * [GBATemp] Multiple fixes - Fix categories: missing "break" statements - Restore thumbnail as enclosure - Fix date extraction - Fix user blog post extraction - Use getSimpleHTMLDOMCached * [JapanExpo] Fix bridge, HTTPS, thumbnails - Fix getSimpleHTMLDOMCached call - Upgrade to HTTPS as JE now offers HTTPS - Restore thumbnails as enclosures * [LeMondeInformatique] Fix bridge, HTTPS - Upgrade to HTTPS as LMI now offers HTTPS - Restore thumbnails using small images - Fix content extraction - Fix text encoding issue * [Nextgov] Fix content extraction - Restore thumbnail and use small image - Field extraction fixes * [NextInpact] Add categories and filtering by type - Offer all RSS feeds - Allow filtering by article type - Implement extraction for brief articles - Remove article limit, many brief articles are publied all at once * [NyaaTorrents] New bridge Anime torrent tracker * [Releases3DS] Cache content, restore thumbnail - Use getSimpleHTMLDOMCached - Restore thumbnail as enclosure * [TheHackerNews] Fix bridge - Fix content extraction including article body - Restore thumbnail as enclosure * [WeLiveSecurity] HTTPS, Fix content extraction - Upgrade to HTTPS as WLS now offers HTTPS - Fix content extraction including article body * [WordPress] Reduce timeout, more content selectors - Reduce timeout to use default one (1h) - Add new content selector (articleBody) - Find thumbnail and set as enclosure - Fix <script> cleanup * [YGGTorrent] Increase limit, use cache - Increase item limit as uploads are very frequent - Use getSimpleHTMLDOMCached * [ZDNet] Rewrite with FeedExpander - Upgrade to HTTPS as ZD now offers HTTPS - Use FeedExpander for secondary fields - Fix content extraction for article body * [Main] Handle MIME type for enclosures Many feed readers will ignore enclosures (e.g. thumbnails) with no MIME type. This commit adds automatic MIME type detection based on file extension (which may be inaccurate but is the only way without fetching the content). One can force enclosure type using #.ext anchor (hacky, needs improving) * [FeedExpander] Improve field extraction - Add support for passing enclosures - Improve author and uri extraction - Fix 'notice' PHP error messages * [Pull] Coding style fixes for #802 * [Pull] Implementing changes for #802 - Fix coding style issues with str append - Remove useless CACHE_TIMEOUT - Use count() instead of $limit - Use defaultLinkTo() + handle strings - Use http_build_query() - Fix missing </em> - Remove error_reporting(0) - warning CSS (@LogMANOriginal) - Fix typo in FeedExpander comment * [Main] More documentation for markdownToHtml See #802 for more details
2018-09-09 21:20:13 +02:00
// Subtitle
$subtitle = $html->find('small.subtitle', 0);
if(!is_object($subtitle) && !is_object($html->find($brief_selector, 0))) {
$subtitle = $html->find('small', 0);
}
if(!is_object($subtitle)) {
$content_wrapper = $html->find('div.content-wrapper', 0);
if (is_object($content_wrapper)) {
$subtitle = $content_wrapper->find('h2.title', 0);
}
}
if(is_object($subtitle) && (!isset($item['title']) || $subtitle->plaintext != $item['title'])) {
$subtitle = '<p><em>' . trim($subtitle->plaintext) . '</em></p>';
Catching up | [Main] Debug mode, parse utils, MIME | [Bridges] Add/Improve 20 bridges (#802) * Debug mode improvements - Improve debug warning message - Restore error reporting in debug mode - Fix 'notice' messages for unset fields * Add parsing utility functions html.php - extractFromDelimiters - stripWithDelimiters - stripRecursiveHTMLSection - markdownToHtml (partial) bridges - remove now-duplicate functions - call functions from html.php instead * [Anidex] New bridge Anime torrent tracker * [Anime-Ultime] Restore thumbnail * [CNET] Recreate bridge Full rewrite as the previous one was broken * [Dilbert] Minor URI fix Use new self::URI property * [EstCeQuonMetEnProd] Fix content extraction Bridge was broken * [Facebook] Fix "SpSonsSoriSsés" label ... which was taking space in item title * [Futura-Sciences] Use HTTPS, More cleanup Use HTTPS as FS now offer HTTPS Clean additional useless HTML elements * [GBATemp] Multiple fixes - Fix categories: missing "break" statements - Restore thumbnail as enclosure - Fix date extraction - Fix user blog post extraction - Use getSimpleHTMLDOMCached * [JapanExpo] Fix bridge, HTTPS, thumbnails - Fix getSimpleHTMLDOMCached call - Upgrade to HTTPS as JE now offers HTTPS - Restore thumbnails as enclosures * [LeMondeInformatique] Fix bridge, HTTPS - Upgrade to HTTPS as LMI now offers HTTPS - Restore thumbnails using small images - Fix content extraction - Fix text encoding issue * [Nextgov] Fix content extraction - Restore thumbnail and use small image - Field extraction fixes * [NextInpact] Add categories and filtering by type - Offer all RSS feeds - Allow filtering by article type - Implement extraction for brief articles - Remove article limit, many brief articles are publied all at once * [NyaaTorrents] New bridge Anime torrent tracker * [Releases3DS] Cache content, restore thumbnail - Use getSimpleHTMLDOMCached - Restore thumbnail as enclosure * [TheHackerNews] Fix bridge - Fix content extraction including article body - Restore thumbnail as enclosure * [WeLiveSecurity] HTTPS, Fix content extraction - Upgrade to HTTPS as WLS now offers HTTPS - Fix content extraction including article body * [WordPress] Reduce timeout, more content selectors - Reduce timeout to use default one (1h) - Add new content selector (articleBody) - Find thumbnail and set as enclosure - Fix <script> cleanup * [YGGTorrent] Increase limit, use cache - Increase item limit as uploads are very frequent - Use getSimpleHTMLDOMCached * [ZDNet] Rewrite with FeedExpander - Upgrade to HTTPS as ZD now offers HTTPS - Use FeedExpander for secondary fields - Fix content extraction for article body * [Main] Handle MIME type for enclosures Many feed readers will ignore enclosures (e.g. thumbnails) with no MIME type. This commit adds automatic MIME type detection based on file extension (which may be inaccurate but is the only way without fetching the content). One can force enclosure type using #.ext anchor (hacky, needs improving) * [FeedExpander] Improve field extraction - Add support for passing enclosures - Improve author and uri extraction - Fix 'notice' PHP error messages * [Pull] Coding style fixes for #802 * [Pull] Implementing changes for #802 - Fix coding style issues with str append - Remove useless CACHE_TIMEOUT - Use count() instead of $limit - Use defaultLinkTo() + handle strings - Use http_build_query() - Fix missing </em> - Remove error_reporting(0) - warning CSS (@LogMANOriginal) - Fix typo in FeedExpander comment * [Main] More documentation for markdownToHtml See #802 for more details
2018-09-09 21:20:13 +02:00
} else {
$subtitle = '';
}
// Image
$postimg = $html->find('div.article-image, div.image-container', 0);
Catching up | [Main] Debug mode, parse utils, MIME | [Bridges] Add/Improve 20 bridges (#802) * Debug mode improvements - Improve debug warning message - Restore error reporting in debug mode - Fix 'notice' messages for unset fields * Add parsing utility functions html.php - extractFromDelimiters - stripWithDelimiters - stripRecursiveHTMLSection - markdownToHtml (partial) bridges - remove now-duplicate functions - call functions from html.php instead * [Anidex] New bridge Anime torrent tracker * [Anime-Ultime] Restore thumbnail * [CNET] Recreate bridge Full rewrite as the previous one was broken * [Dilbert] Minor URI fix Use new self::URI property * [EstCeQuonMetEnProd] Fix content extraction Bridge was broken * [Facebook] Fix "SpSonsSoriSsés" label ... which was taking space in item title * [Futura-Sciences] Use HTTPS, More cleanup Use HTTPS as FS now offer HTTPS Clean additional useless HTML elements * [GBATemp] Multiple fixes - Fix categories: missing "break" statements - Restore thumbnail as enclosure - Fix date extraction - Fix user blog post extraction - Use getSimpleHTMLDOMCached * [JapanExpo] Fix bridge, HTTPS, thumbnails - Fix getSimpleHTMLDOMCached call - Upgrade to HTTPS as JE now offers HTTPS - Restore thumbnails as enclosures * [LeMondeInformatique] Fix bridge, HTTPS - Upgrade to HTTPS as LMI now offers HTTPS - Restore thumbnails using small images - Fix content extraction - Fix text encoding issue * [Nextgov] Fix content extraction - Restore thumbnail and use small image - Field extraction fixes * [NextInpact] Add categories and filtering by type - Offer all RSS feeds - Allow filtering by article type - Implement extraction for brief articles - Remove article limit, many brief articles are publied all at once * [NyaaTorrents] New bridge Anime torrent tracker * [Releases3DS] Cache content, restore thumbnail - Use getSimpleHTMLDOMCached - Restore thumbnail as enclosure * [TheHackerNews] Fix bridge - Fix content extraction including article body - Restore thumbnail as enclosure * [WeLiveSecurity] HTTPS, Fix content extraction - Upgrade to HTTPS as WLS now offers HTTPS - Fix content extraction including article body * [WordPress] Reduce timeout, more content selectors - Reduce timeout to use default one (1h) - Add new content selector (articleBody) - Find thumbnail and set as enclosure - Fix <script> cleanup * [YGGTorrent] Increase limit, use cache - Increase item limit as uploads are very frequent - Use getSimpleHTMLDOMCached * [ZDNet] Rewrite with FeedExpander - Upgrade to HTTPS as ZD now offers HTTPS - Use FeedExpander for secondary fields - Fix content extraction for article body * [Main] Handle MIME type for enclosures Many feed readers will ignore enclosures (e.g. thumbnails) with no MIME type. This commit adds automatic MIME type detection based on file extension (which may be inaccurate but is the only way without fetching the content). One can force enclosure type using #.ext anchor (hacky, needs improving) * [FeedExpander] Improve field extraction - Add support for passing enclosures - Improve author and uri extraction - Fix 'notice' PHP error messages * [Pull] Coding style fixes for #802 * [Pull] Implementing changes for #802 - Fix coding style issues with str append - Remove useless CACHE_TIMEOUT - Use count() instead of $limit - Use defaultLinkTo() + handle strings - Use http_build_query() - Fix missing </em> - Remove error_reporting(0) - warning CSS (@LogMANOriginal) - Fix typo in FeedExpander comment * [Main] More documentation for markdownToHtml See #802 for more details
2018-09-09 21:20:13 +02:00
if(is_object($postimg)) {
$postimg = $postimg->find('img', 0);
if (!empty($postimg->src)) {
$postimg = $postimg->src;
} else {
$postimg = $postimg->srcset; //"url 355w, url 1003w, url 748w"
$postimg = explode(', ', $postimg); //split by ', ' to get each url separately
$postimg = end($postimg); //Get last item: "url 748w" which is of largest size
$postimg = explode(' ', $postimg); //split by ' ' to separate url from res
$postimg = array_reverse($postimg); //reverse array content to have url last
$postimg = end($postimg); //Get last item of array: "url"
}
$postimg = '<p><img src="' . $postimg . '" alt="-" /></p>';
Catching up | [Main] Debug mode, parse utils, MIME | [Bridges] Add/Improve 20 bridges (#802) * Debug mode improvements - Improve debug warning message - Restore error reporting in debug mode - Fix 'notice' messages for unset fields * Add parsing utility functions html.php - extractFromDelimiters - stripWithDelimiters - stripRecursiveHTMLSection - markdownToHtml (partial) bridges - remove now-duplicate functions - call functions from html.php instead * [Anidex] New bridge Anime torrent tracker * [Anime-Ultime] Restore thumbnail * [CNET] Recreate bridge Full rewrite as the previous one was broken * [Dilbert] Minor URI fix Use new self::URI property * [EstCeQuonMetEnProd] Fix content extraction Bridge was broken * [Facebook] Fix "SpSonsSoriSsés" label ... which was taking space in item title * [Futura-Sciences] Use HTTPS, More cleanup Use HTTPS as FS now offer HTTPS Clean additional useless HTML elements * [GBATemp] Multiple fixes - Fix categories: missing "break" statements - Restore thumbnail as enclosure - Fix date extraction - Fix user blog post extraction - Use getSimpleHTMLDOMCached * [JapanExpo] Fix bridge, HTTPS, thumbnails - Fix getSimpleHTMLDOMCached call - Upgrade to HTTPS as JE now offers HTTPS - Restore thumbnails as enclosures * [LeMondeInformatique] Fix bridge, HTTPS - Upgrade to HTTPS as LMI now offers HTTPS - Restore thumbnails using small images - Fix content extraction - Fix text encoding issue * [Nextgov] Fix content extraction - Restore thumbnail and use small image - Field extraction fixes * [NextInpact] Add categories and filtering by type - Offer all RSS feeds - Allow filtering by article type - Implement extraction for brief articles - Remove article limit, many brief articles are publied all at once * [NyaaTorrents] New bridge Anime torrent tracker * [Releases3DS] Cache content, restore thumbnail - Use getSimpleHTMLDOMCached - Restore thumbnail as enclosure * [TheHackerNews] Fix bridge - Fix content extraction including article body - Restore thumbnail as enclosure * [WeLiveSecurity] HTTPS, Fix content extraction - Upgrade to HTTPS as WLS now offers HTTPS - Fix content extraction including article body * [WordPress] Reduce timeout, more content selectors - Reduce timeout to use default one (1h) - Add new content selector (articleBody) - Find thumbnail and set as enclosure - Fix <script> cleanup * [YGGTorrent] Increase limit, use cache - Increase item limit as uploads are very frequent - Use getSimpleHTMLDOMCached * [ZDNet] Rewrite with FeedExpander - Upgrade to HTTPS as ZD now offers HTTPS - Use FeedExpander for secondary fields - Fix content extraction for article body * [Main] Handle MIME type for enclosures Many feed readers will ignore enclosures (e.g. thumbnails) with no MIME type. This commit adds automatic MIME type detection based on file extension (which may be inaccurate but is the only way without fetching the content). One can force enclosure type using #.ext anchor (hacky, needs improving) * [FeedExpander] Improve field extraction - Add support for passing enclosures - Improve author and uri extraction - Fix 'notice' PHP error messages * [Pull] Coding style fixes for #802 * [Pull] Implementing changes for #802 - Fix coding style issues with str append - Remove useless CACHE_TIMEOUT - Use count() instead of $limit - Use defaultLinkTo() + handle strings - Use http_build_query() - Fix missing </em> - Remove error_reporting(0) - warning CSS (@LogMANOriginal) - Fix typo in FeedExpander comment * [Main] More documentation for markdownToHtml See #802 for more details
2018-09-09 21:20:13 +02:00
} else {
$postimg = '';
}
// Paywall
$paywall = $html->find('div.paywall-restriction', 0);
if (is_object($paywall) && is_object($paywall->find('p.red-msg', 0))) {
$paywall = '<p><em>' . $paywall->find('span.head-mention', 0)->innertext . '</em></p>';
} else {
$paywall = '';
}
// Content
$article_content = $article_content->outertext;
$article_content = str_replace('>Signaler une erreur</span>', '></span>', $article_content);
// Result
Catching up | [Main] Debug mode, parse utils, MIME | [Bridges] Add/Improve 20 bridges (#802) * Debug mode improvements - Improve debug warning message - Restore error reporting in debug mode - Fix 'notice' messages for unset fields * Add parsing utility functions html.php - extractFromDelimiters - stripWithDelimiters - stripRecursiveHTMLSection - markdownToHtml (partial) bridges - remove now-duplicate functions - call functions from html.php instead * [Anidex] New bridge Anime torrent tracker * [Anime-Ultime] Restore thumbnail * [CNET] Recreate bridge Full rewrite as the previous one was broken * [Dilbert] Minor URI fix Use new self::URI property * [EstCeQuonMetEnProd] Fix content extraction Bridge was broken * [Facebook] Fix "SpSonsSoriSsés" label ... which was taking space in item title * [Futura-Sciences] Use HTTPS, More cleanup Use HTTPS as FS now offer HTTPS Clean additional useless HTML elements * [GBATemp] Multiple fixes - Fix categories: missing "break" statements - Restore thumbnail as enclosure - Fix date extraction - Fix user blog post extraction - Use getSimpleHTMLDOMCached * [JapanExpo] Fix bridge, HTTPS, thumbnails - Fix getSimpleHTMLDOMCached call - Upgrade to HTTPS as JE now offers HTTPS - Restore thumbnails as enclosures * [LeMondeInformatique] Fix bridge, HTTPS - Upgrade to HTTPS as LMI now offers HTTPS - Restore thumbnails using small images - Fix content extraction - Fix text encoding issue * [Nextgov] Fix content extraction - Restore thumbnail and use small image - Field extraction fixes * [NextInpact] Add categories and filtering by type - Offer all RSS feeds - Allow filtering by article type - Implement extraction for brief articles - Remove article limit, many brief articles are publied all at once * [NyaaTorrents] New bridge Anime torrent tracker * [Releases3DS] Cache content, restore thumbnail - Use getSimpleHTMLDOMCached - Restore thumbnail as enclosure * [TheHackerNews] Fix bridge - Fix content extraction including article body - Restore thumbnail as enclosure * [WeLiveSecurity] HTTPS, Fix content extraction - Upgrade to HTTPS as WLS now offers HTTPS - Fix content extraction including article body * [WordPress] Reduce timeout, more content selectors - Reduce timeout to use default one (1h) - Add new content selector (articleBody) - Find thumbnail and set as enclosure - Fix <script> cleanup * [YGGTorrent] Increase limit, use cache - Increase item limit as uploads are very frequent - Use getSimpleHTMLDOMCached * [ZDNet] Rewrite with FeedExpander - Upgrade to HTTPS as ZD now offers HTTPS - Use FeedExpander for secondary fields - Fix content extraction for article body * [Main] Handle MIME type for enclosures Many feed readers will ignore enclosures (e.g. thumbnails) with no MIME type. This commit adds automatic MIME type detection based on file extension (which may be inaccurate but is the only way without fetching the content). One can force enclosure type using #.ext anchor (hacky, needs improving) * [FeedExpander] Improve field extraction - Add support for passing enclosures - Improve author and uri extraction - Fix 'notice' PHP error messages * [Pull] Coding style fixes for #802 * [Pull] Implementing changes for #802 - Fix coding style issues with str append - Remove useless CACHE_TIMEOUT - Use count() instead of $limit - Use defaultLinkTo() + handle strings - Use http_build_query() - Fix missing </em> - Remove error_reporting(0) - warning CSS (@LogMANOriginal) - Fix typo in FeedExpander comment * [Main] More documentation for markdownToHtml See #802 for more details
2018-09-09 21:20:13 +02:00
$text = $subtitle
. $postimg
. $article_content
. $paywall;
Catching up | [Main] Debug mode, parse utils, MIME | [Bridges] Add/Improve 20 bridges (#802) * Debug mode improvements - Improve debug warning message - Restore error reporting in debug mode - Fix 'notice' messages for unset fields * Add parsing utility functions html.php - extractFromDelimiters - stripWithDelimiters - stripRecursiveHTMLSection - markdownToHtml (partial) bridges - remove now-duplicate functions - call functions from html.php instead * [Anidex] New bridge Anime torrent tracker * [Anime-Ultime] Restore thumbnail * [CNET] Recreate bridge Full rewrite as the previous one was broken * [Dilbert] Minor URI fix Use new self::URI property * [EstCeQuonMetEnProd] Fix content extraction Bridge was broken * [Facebook] Fix "SpSonsSoriSsés" label ... which was taking space in item title * [Futura-Sciences] Use HTTPS, More cleanup Use HTTPS as FS now offer HTTPS Clean additional useless HTML elements * [GBATemp] Multiple fixes - Fix categories: missing "break" statements - Restore thumbnail as enclosure - Fix date extraction - Fix user blog post extraction - Use getSimpleHTMLDOMCached * [JapanExpo] Fix bridge, HTTPS, thumbnails - Fix getSimpleHTMLDOMCached call - Upgrade to HTTPS as JE now offers HTTPS - Restore thumbnails as enclosures * [LeMondeInformatique] Fix bridge, HTTPS - Upgrade to HTTPS as LMI now offers HTTPS - Restore thumbnails using small images - Fix content extraction - Fix text encoding issue * [Nextgov] Fix content extraction - Restore thumbnail and use small image - Field extraction fixes * [NextInpact] Add categories and filtering by type - Offer all RSS feeds - Allow filtering by article type - Implement extraction for brief articles - Remove article limit, many brief articles are publied all at once * [NyaaTorrents] New bridge Anime torrent tracker * [Releases3DS] Cache content, restore thumbnail - Use getSimpleHTMLDOMCached - Restore thumbnail as enclosure * [TheHackerNews] Fix bridge - Fix content extraction including article body - Restore thumbnail as enclosure * [WeLiveSecurity] HTTPS, Fix content extraction - Upgrade to HTTPS as WLS now offers HTTPS - Fix content extraction including article body * [WordPress] Reduce timeout, more content selectors - Reduce timeout to use default one (1h) - Add new content selector (articleBody) - Find thumbnail and set as enclosure - Fix <script> cleanup * [YGGTorrent] Increase limit, use cache - Increase item limit as uploads are very frequent - Use getSimpleHTMLDOMCached * [ZDNet] Rewrite with FeedExpander - Upgrade to HTTPS as ZD now offers HTTPS - Use FeedExpander for secondary fields - Fix content extraction for article body * [Main] Handle MIME type for enclosures Many feed readers will ignore enclosures (e.g. thumbnails) with no MIME type. This commit adds automatic MIME type detection based on file extension (which may be inaccurate but is the only way without fetching the content). One can force enclosure type using #.ext anchor (hacky, needs improving) * [FeedExpander] Improve field extraction - Add support for passing enclosures - Improve author and uri extraction - Fix 'notice' PHP error messages * [Pull] Coding style fixes for #802 * [Pull] Implementing changes for #802 - Fix coding style issues with str append - Remove useless CACHE_TIMEOUT - Use count() instead of $limit - Use defaultLinkTo() + handle strings - Use http_build_query() - Fix missing </em> - Remove error_reporting(0) - warning CSS (@LogMANOriginal) - Fix typo in FeedExpander comment * [Main] More documentation for markdownToHtml See #802 for more details
2018-09-09 21:20:13 +02:00
} else {
$text = '<p><em>Failed to retrieve full article content</em></p>';
if (isset($item['content'])) {
$text = $item['content'] . $text;
}
Catching up | [Main] Debug mode, parse utils, MIME | [Bridges] Add/Improve 20 bridges (#802) * Debug mode improvements - Improve debug warning message - Restore error reporting in debug mode - Fix 'notice' messages for unset fields * Add parsing utility functions html.php - extractFromDelimiters - stripWithDelimiters - stripRecursiveHTMLSection - markdownToHtml (partial) bridges - remove now-duplicate functions - call functions from html.php instead * [Anidex] New bridge Anime torrent tracker * [Anime-Ultime] Restore thumbnail * [CNET] Recreate bridge Full rewrite as the previous one was broken * [Dilbert] Minor URI fix Use new self::URI property * [EstCeQuonMetEnProd] Fix content extraction Bridge was broken * [Facebook] Fix "SpSonsSoriSsés" label ... which was taking space in item title * [Futura-Sciences] Use HTTPS, More cleanup Use HTTPS as FS now offer HTTPS Clean additional useless HTML elements * [GBATemp] Multiple fixes - Fix categories: missing "break" statements - Restore thumbnail as enclosure - Fix date extraction - Fix user blog post extraction - Use getSimpleHTMLDOMCached * [JapanExpo] Fix bridge, HTTPS, thumbnails - Fix getSimpleHTMLDOMCached call - Upgrade to HTTPS as JE now offers HTTPS - Restore thumbnails as enclosures * [LeMondeInformatique] Fix bridge, HTTPS - Upgrade to HTTPS as LMI now offers HTTPS - Restore thumbnails using small images - Fix content extraction - Fix text encoding issue * [Nextgov] Fix content extraction - Restore thumbnail and use small image - Field extraction fixes * [NextInpact] Add categories and filtering by type - Offer all RSS feeds - Allow filtering by article type - Implement extraction for brief articles - Remove article limit, many brief articles are publied all at once * [NyaaTorrents] New bridge Anime torrent tracker * [Releases3DS] Cache content, restore thumbnail - Use getSimpleHTMLDOMCached - Restore thumbnail as enclosure * [TheHackerNews] Fix bridge - Fix content extraction including article body - Restore thumbnail as enclosure * [WeLiveSecurity] HTTPS, Fix content extraction - Upgrade to HTTPS as WLS now offers HTTPS - Fix content extraction including article body * [WordPress] Reduce timeout, more content selectors - Reduce timeout to use default one (1h) - Add new content selector (articleBody) - Find thumbnail and set as enclosure - Fix <script> cleanup * [YGGTorrent] Increase limit, use cache - Increase item limit as uploads are very frequent - Use getSimpleHTMLDOMCached * [ZDNet] Rewrite with FeedExpander - Upgrade to HTTPS as ZD now offers HTTPS - Use FeedExpander for secondary fields - Fix content extraction for article body * [Main] Handle MIME type for enclosures Many feed readers will ignore enclosures (e.g. thumbnails) with no MIME type. This commit adds automatic MIME type detection based on file extension (which may be inaccurate but is the only way without fetching the content). One can force enclosure type using #.ext anchor (hacky, needs improving) * [FeedExpander] Improve field extraction - Add support for passing enclosures - Improve author and uri extraction - Fix 'notice' PHP error messages * [Pull] Coding style fixes for #802 * [Pull] Implementing changes for #802 - Fix coding style issues with str append - Remove useless CACHE_TIMEOUT - Use count() instead of $limit - Use defaultLinkTo() + handle strings - Use http_build_query() - Fix missing </em> - Remove error_reporting(0) - warning CSS (@LogMANOriginal) - Fix typo in FeedExpander comment * [Main] More documentation for markdownToHtml See #802 for more details
2018-09-09 21:20:13 +02:00
}
return $text;
}
}