Merge branch 'LWNprevBridge' of https://framagit.org/peetah/rss-bridge
This commit is contained in:
commit
b43e8ef689
1 changed files with 7 additions and 5 deletions
|
@ -52,11 +52,12 @@ class LWNprevBridge extends BridgeAbstract{
|
||||||
$context = stream_context_create($context);
|
$context = stream_context_create($context);
|
||||||
}
|
}
|
||||||
|
|
||||||
$html=file_get_contents($uri, false, $context)
|
$content=file_get_contents($uri, false, $context)
|
||||||
or $this->returnServerError('No results for LWNprev');
|
or $this->returnServerError('No results for LWNprev');
|
||||||
|
|
||||||
libxml_use_internal_errors(true);
|
libxml_use_internal_errors(true);
|
||||||
$html=DOMDocument::loadHTML($html);
|
$html=new DOMDocument();
|
||||||
|
$html->loadHTML($content);
|
||||||
libxml_clear_errors();
|
libxml_clear_errors();
|
||||||
|
|
||||||
$cat1='';
|
$cat1='';
|
||||||
|
@ -101,7 +102,7 @@ class LWNprevBridge extends BridgeAbstract{
|
||||||
|
|
||||||
$h2FirstChild=$h2->firstChild;
|
$h2FirstChild=$h2->firstChild;
|
||||||
$this->jumpToNextTag($h2FirstChild);
|
$this->jumpToNextTag($h2FirstChild);
|
||||||
if($h2FirstChild->tagName==='a'){
|
if($h2FirstChild->nodeName==='a'){
|
||||||
$item->uri='https://lwn.net'.$h2FirstChild->getAttribute('href');
|
$item->uri='https://lwn.net'.$h2FirstChild->getAttribute('href');
|
||||||
}else{
|
}else{
|
||||||
$item->uri=$realURI.'#'.$URICounter;
|
$item->uri=$realURI.'#'.$URICounter;
|
||||||
|
@ -145,8 +146,9 @@ class LWNprevBridge extends BridgeAbstract{
|
||||||
if(
|
if(
|
||||||
!$node || (
|
!$node || (
|
||||||
$node->nodeType!==XML_TEXT_NODE && (
|
$node->nodeType!==XML_TEXT_NODE && (
|
||||||
$node->tagName==='h2' ||
|
$node->nodeName==='h2' ||
|
||||||
in_array($node->getAttribute('class'),array('Cat1HL','Cat2HL'))
|
(!is_null($node->attributes) && !is_null($class=$node->attributes->getNamedItem('class')) &&
|
||||||
|
in_array($class->nodeValue,array('Cat1HL','Cat2HL')))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
){
|
){
|
||||||
|
|
Loading…
Reference in a new issue