X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=mod%2Fparse_url.php;h=46c6b46e97998e3db59b542d11b3b15b937c8fe4;hb=cfc7f8308f5e1756d1ea7b2fadd317821442d16c;hp=bf6639b300a72cd6a24cd2c6a14aa186fe6a9862;hpb=35edf79abe08bcc1833dc695cb9aebfa5d4a78c0;p=friendica.git
diff --git a/mod/parse_url.php b/mod/parse_url.php
index bf6639b300..46c6b46e97 100644
--- a/mod/parse_url.php
+++ b/mod/parse_url.php
@@ -13,7 +13,7 @@ function parse_url_content(&$a) {
$text = null;
- $template = "%s\n%s";
+ $template = "
%s%s
";
$arr = array('url' => $url, 'text' => '');
@@ -42,7 +42,7 @@ function parse_url_content(&$a) {
if(strpos($s,'
')) {
$title = substr($s,strpos($s,'')+7,64);
if(strpos($title,'<') !== false)
- $title = substr($title,0,strpos($title,'<'));
+ $title = strip_tags(substr($title,0,strpos($title,'<')));
}
$config = HTMLPurifier_Config::createDefault();
@@ -51,6 +51,8 @@ function parse_url_content(&$a) {
$purifier = new HTMLPurifier($config);
$s = $purifier->purify($s);
+// logger('parse_url: purified: ' . $s, LOGGER_DATA);
+
$dom = @HTML5_Parser::parse($s);
if(! $dom) {
@@ -71,21 +73,27 @@ function parse_url_content(&$a) {
if($divs) {
foreach($divs as $div) {
$class = $div->getAttribute('class');
- if($class && stristr($class,'article')) {
+ if($class && (stristr($class,'article') || stristr($class,'content'))) {
$items = $div->getElementsByTagName('p');
if($items) {
foreach($items as $item) {
- if($item->getElementsByTagName('script'))
- continue;
$text = $item->textContent;
+ if(stristr($text,'