commit 3973d81ba351cdf55d22c50f6d85202f1d651dbf
parent 76bc9d533bbbe60c013db4cc056f6d52786f5f9d
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date: Sat, 1 Mar 2025 15:06:22 +0100
feat: performance improvements
Diffstat:
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/index.php b/index.php
@@ -132,10 +132,10 @@
$video["title"] = str_replace(array("&"), "&", $entry["title"]);
// Get Video Description
- $video["desc"] = str_replace(
- array("\n"),
+ $video["desc"] = preg_replace(
+ "/\n+/",
"<br>",
- preg_replace("/\n+/", "\n", $entry["media_group"]["media_description"])
+ $entry["media_group"]["media_description"]
);
if (empty($video["desc"])) {
$video["desc"] = "";
@@ -157,18 +157,11 @@
* description only contains #hashtags
* has no description at all
*/
- $vdesc = explode(
- " ",
- preg_replace(
- '/\s+/',
- ' ',
- preg_replace('/\t|\n|\r|\0|\v/', ' ', trim($video["desc"]))
- )
- );
+ $vdesc = explode(" ", $video["desc"]);
if (
preg_match('/#short(s)*/', $video["title"]) > 0 ||
preg_match('/#short(s)*/', $video["desc"]) > 0 ||
- preg_grep('/^#/', $vdesc) == $vdesc ||
+ preg_grep('/^(#|$)/', $vdesc) == $vdesc ||
strlen($video["desc"]) == 0
) {
continue;