This commit is contained in:
2021-07-13 20:57:55 -03:00
parent 254bf0708f
commit aaef157e38
11 changed files with 1652 additions and 6 deletions

0
img/credits.txt Normal file → Executable file
View File

0
img/logo.svg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

0
img/test.jpg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 81 KiB

0
index.php Normal file → Executable file
View File

0
mySQLconnect.php Normal file → Executable file
View File

3
news/00_news_done.txt Normal file → Executable file
View File

@@ -1,3 +0,0 @@
./news/aaa.html
./news/bbb.html
./news/ccc.html

View File

1593
news/xataka.html Executable file

File diff suppressed because one or more lines are too long

62
news_logic.php Normal file → Executable file
View File

@@ -1,5 +1,8 @@
<?php
error_reporting(~0);
ini_set('display_errors', 1);
function check_news() {
$news = glob('./news/*');
@@ -21,9 +24,12 @@ function check_news() {
echo '<br>';
if (!strstr($news_done, $new)) {
$author = know_autor($new); //! HACER FUNCION
$create_entry($new, $author); //! HACER FUNCION
file_put_contents($news_done, $new . '/n', FILE_APPEND);
$page = know_page($new); //! HACER FUNCION
echo $page;
$author = know_author($page, $new);
echo $author;
//$create_entry_in_DB($new, $author); //! HACER FUNCION
//file_put_contents($news_done, $new . '/n', FILE_APPEND);
}
/*if ($new is in $done) {
@@ -33,4 +39,54 @@ function check_news() {
}
}
function know_page($new) {
switch ($new) {
case './news/xataka.html'|| './news/Xataka.html':
return 'Xataka';
break;
default:
return 0;
break;
}
}
function know_author($page, $new) {
$content = file_get_contents($new);
switch ($page) {
case 'Xataka':
$frist_cut = get_string_between($content, '<a class="article-author-link" ', '</a>');
$second_cut = strrchr($frist_cut, '>');
return str_replace('>', '', $second_cut);
break;
default:
return 0;
break;
}
}
function get_string_between($string, $start, $end){
$string = ' ' . $string;
$ini = strpos($string, $start);
if ($ini == 0) return '';
$ini += strlen($start);
$len = strpos($string, $end, $ini) - $ini;
return substr($string, $ini, $len);
//! CREDITS: https://stackoverflow.com/questions/5696412/how-to-get-a-substring-between-two-strings-in-phphttps://stackoverflow.com/questions/5696412/how-to-get-a-substring-between-two-strings-in-php
}
/*
switch ($variable) {
case 'value':
# code...
break;
default:
# code...
break;
}
*/
?>

0
script.js Normal file → Executable file
View File

0
style.css Normal file → Executable file
View File