Skip to content

Commit

Permalink
Adiciona SIC e TVI
Browse files Browse the repository at this point in the history
  • Loading branch information
ghnp5 committed Nov 13, 2024
1 parent 7ea9440 commit f38c128
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 2 deletions.
15 changes: 13 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ <h2>Plataformas de Streaming</h2>
<div class="grid-container" id="streaming-grid"></div>

<script>
const fetchJSON = async (url) => {
const response = await fetch(url);
const text = await response.text();

// remove comments
const jsonString = text.replace(/\/\/.*|\/\*[^]*?\*\//g, '').trim();

const data = JSON.parse(jsonString);
return data;
}

const genHtml = (div) => (channels) => {
const gridContainer = document.getElementById(div);
channels.forEach(channel => {
Expand All @@ -65,11 +76,11 @@ <h2>Plataformas de Streaming</h2>
});
};

fetch('livetv.json')
fetchJSON('livetv.json')
.then(response => response.json())
.then(genHtml('livetv-grid'))
.catch(error => console.error('Erro (livetv):', error));
fetch('streaming.json')
fetchJSON('streaming.json')
.then(response => response.json())
.then(genHtml('streaming-grid'))
.catch(error => console.error('Erro (streaming):', error));
Expand Down
43 changes: 43 additions & 0 deletions livetv.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[
/* https://www.rtp.pt/ */
{
"name": "RTP 1",
"url": "https://www.rtp.pt/play/direto/rtp1",
Expand Down Expand Up @@ -73,5 +74,47 @@
"name": "RTP Desporto 6",
"url": "https://www.rtp.pt/play/direto/rtpdesporto6",
"img": "https://cdn-images.rtp.pt/common/img/channels/logos/color/horizontal/1096-415422201607.png"
},
/* https://sic.pt/ */
{
"name": "SIC",
"url": "https://sic.pt/direto",
"img": "https://images.impresa.pt/sic/2021-04-07-logo-sic.png-45b11c81-1"
},
{
"name": "SIC Notícias",
"url": "https://sicnoticias.pt/agora",
"img": "https://sdistribution.impresa.pt/data/content/binaries/b58/207/7422461b-ba2f-49d1-a5bf-dcddad117f38/sicnot.svg"
},
/* https://tviplayer.iol.pt/ */
{
"name": "TVI",
"url": "https://tvi.iol.pt//direto/TVI",
"img": "https://cdn.iol.pt/img/logostvi/branco/tvi.png"
},
{
"name": "CNN",
"url": "https://tvi.iol.pt//direto/CNN",
"img": "https://cdn.iol.pt/img/logostvi/branco/cnn.png"
},
{
"name": "TVI Reality",
"url": "https://tvi.iol.pt//direto/TVI_REALITY",
"img": "https://cdn.iol.pt/img/logostvi/branco/tvireality.png"
},
{
"name": "VMais",
"url": "https://tvi.iol.pt//direto/VMAIS",
"img": "https://cdn.iol.pt/img/logostvi/branco/vmaistvi.png"
},
{
"name": "TVI África",
"url": "https://tvi.iol.pt//direto/TVI_AFRICA",
"img": "https://cdn.iol.pt/img/logostvi/branco/tviafrica.png"
},
{
"name": "TVI Internacional",
"url": "https://tvi.iol.pt//direto/TVI_INTERNACIONAL",
"img": "https://cdn.iol.pt/img/logostvi/branco/tviinternacional.png"
}
]

0 comments on commit f38c128

Please sign in to comment.