Compensate for changes in Google News feed

This commit is contained in:
Action Retro 2023-03-04 12:10:27 -05:00 committed by GitHub
parent e788075216
commit 42c3dfc2e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 4 deletions

View File

@ -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

BIN
composer.phar Normal file

Binary file not shown.

View File

@ -1,5 +1,5 @@
<?php
header("X-Robots-Tag: noindex, nofollow", true);
$url = "";
$loc = "US";

View File

@ -1,5 +1,5 @@
<?php
header("X-Robots-Tag: noindex, nofollow", true);
$url = "";
$filetype = "";
$raw_image = NULL;

View File

@ -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";