Compensate for changes in Google News feed
This commit is contained in:
parent
e788075216
commit
42c3dfc2e4
10
article.php
10
article.php
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
error_reporting(E_ERROR | E_PARSE);
|
||||
header("X-Robots-Tag: noindex, nofollow", true);
|
||||
require_once('vendor/autoload.php');
|
||||
|
||||
$article_url = "";
|
||||
|
@ -22,6 +24,12 @@ if (substr( $article_url, 0, 23 ) != "https://news.google.com") {
|
|||
die();
|
||||
}
|
||||
|
||||
/* just a hacky fix lol, maybe make this better later */
|
||||
$google_redirect_page = file_get_contents($article_url);
|
||||
$parts = explode('<a href="', $google_redirect_page);
|
||||
$actual_article_url = explode('"',$parts[1])[0];
|
||||
$article_url = $actual_article_url;
|
||||
|
||||
use andreskrey\Readability\Readability;
|
||||
use andreskrey\Readability\Configuration;
|
||||
use andreskrey\Readability\ParseException;
|
||||
|
@ -45,7 +53,7 @@ try {
|
|||
$readable_article = clean_str($readable_article);
|
||||
|
||||
} catch (ParseException $e) {
|
||||
$error_text .= 'Sorry! ' . $e->getMessage() . '<br>';
|
||||
$error_text .= 'Sorry - working on it! ' . $e->getMessage() . '<br>';
|
||||
}
|
||||
|
||||
//replace chars that old machines probably can't handle
|
||||
|
|
Binary file not shown.
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
|
||||
header("X-Robots-Tag: noindex, nofollow", true);
|
||||
$url = "";
|
||||
$loc = "US";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
|
||||
header("X-Robots-Tag: noindex, nofollow", true);
|
||||
$url = "";
|
||||
$filetype = "";
|
||||
$raw_image = NULL;
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
<?php
|
||||
// send noindex headers if any url params
|
||||
$any_params = parse_url("http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
|
||||
//if(strlen($any_params['query']) > 0) {
|
||||
if(array_key_exists('query', $any_params)) {
|
||||
header("X-Robots-Tag: noindex, nofollow", true);
|
||||
}
|
||||
|
||||
require_once('php/autoloader.php');
|
||||
//require_once('php/autoloader.php');
|
||||
require_once('vendor/SimplePie.compiled.php');
|
||||
|
||||
$section="";
|
||||
$loc = "US";
|
||||
|
|
Loading…
Reference in New Issue