mirror of
https://github.com/FranP-code/Allnews.com.git
synced 2025-10-13 00:32:45 +00:00
Añadido soporte para TN
This commit is contained in:
@@ -1 +1 @@
|
||||
8
|
||||
9
|
||||
@@ -1 +1 @@
|
||||
./news/1.html ./news/2.html ./news/3.html ./news/4.html ./news/5.html ./news/6.html ./news/7.html ./news/8.html
|
||||
./news/1.html ./news/2.html ./news/3.html ./news/4.html ./news/5.html ./news/6.html ./news/7.html ./news/8.html ./news/9.html
|
||||
2
news.css
2
news.css
@@ -65,7 +65,7 @@ img {
|
||||
|
||||
article img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
height: auto;
|
||||
margin-bottom: 2vh;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,10 @@ function know_page($news_unique) {
|
||||
case $news_unique === './news/infobae.html' || $news_unique === './news/Infobae.html':
|
||||
return 'Infobae';
|
||||
break;
|
||||
|
||||
case $news_unique === './news/tn.html' || $news_unique === './news/TN.html' || $news_unique === './news/Tn.html':
|
||||
return 'TN';
|
||||
break;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
@@ -59,6 +63,10 @@ function know_author($page, $news_unique) {
|
||||
return $author = get_string_between($content, ',t.authors="', '",');
|
||||
break;
|
||||
|
||||
case $page === 'TN':
|
||||
return $author = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
@@ -106,11 +114,18 @@ function create_entry_in_DB($news_unique, $page, $author) {
|
||||
$frist_p = get_string_between($content, '<meta property="og:description" content="', '">');
|
||||
break;
|
||||
|
||||
case $page === 'TN':
|
||||
$title = get_string_between($content, '</script><title itemProp="name" lang="es">', ' | TN</title>');
|
||||
$icon = get_string_between($content, '<source type="image/jpg" srcSet="', '"');
|
||||
$inner_HTML = get_string_between($content, '<main class="col-content">', '</main>') . '<script id="script-estructurador" src="./scripts/tn.js"></script>';
|
||||
$frist_p = get_string_between($content, ',"description":"', '","articleBody":"');
|
||||
break;
|
||||
default:
|
||||
echo 0;
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
|
||||
$title;
|
||||
$icon;
|
||||
$inner_HTML;
|
||||
|
||||
53
scripts/tn.js
Normal file
53
scripts/tn.js
Normal file
@@ -0,0 +1,53 @@
|
||||
//todo - Informacion sobre tn
|
||||
|
||||
title = document.getElementsByClassName('article__title bold')[0]
|
||||
console.log(title);
|
||||
|
||||
sub_title = document.getElementsByClassName('article__dropline soft')[0]
|
||||
console.log(sub_title)
|
||||
|
||||
article = document.getElementsByClassName('article__body')[0]
|
||||
|
||||
trash = [
|
||||
document.getElementsByClassName('flex justify_space_between align_items_center padding_bottom-sm')[0],
|
||||
|
||||
document.getElementsByClassName('time__container')[0]
|
||||
]
|
||||
console.log(trash);
|
||||
|
||||
ads = document.getElementsByClassName('interstitial--link')
|
||||
console.log(ads)
|
||||
|
||||
|
||||
//todo - Purificacion de la informacion
|
||||
|
||||
for (let i = 0; i < trash.length; i++) {
|
||||
trash[i].innerHTML = ''
|
||||
}
|
||||
|
||||
for (let i = 0; i < ads.length; i++) {
|
||||
ads[i].innerHTML = '';
|
||||
|
||||
}
|
||||
|
||||
//todo - Añadir sub-titulo al articulo y eliminar el original
|
||||
|
||||
newParagraph = document.createElement('p')
|
||||
|
||||
newParagraph.innerText = sub_title.innerText
|
||||
|
||||
article.prepend(newParagraph)
|
||||
|
||||
sub_title.remove()
|
||||
|
||||
console.log(newParagraph);
|
||||
|
||||
//todo - Eliminar el titulo
|
||||
|
||||
title.remove()
|
||||
|
||||
//todo - Eliminar el script
|
||||
|
||||
script = document.getElementById('script-estructurator');
|
||||
|
||||
script.remove()
|
||||
Reference in New Issue
Block a user