Skip to content

Commit 23444d2

Browse files
committed
Added new broadcasts
1 parent 208380a commit 23444d2

8 files changed

+540
-0
lines changed

RTS/12h30.php

+135
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
<?php
2+
// Julien Muggli
3+
// Inspired by the work of sitopp, at https://github.com/sitopp/Alexa_FlashBriefing_ArsenalFeed
4+
5+
$rss_url = "https://www.rts.ch/la-1ere/programmes/le-12h30/podcast/?flux=rss";
6+
$rss_data = simplexml_load_file($rss_url, 'SimpleXMLElement', LIBXML_NOCDATA);
7+
$json = json_encode($rss_data);
8+
$array = json_decode($json, TRUE);
9+
$streamUrl = $array['channel']['item'][0]['enclosure']['@attributes']['url'];
10+
$result_array = array();
11+
$i = 0;
12+
13+
foreach($array as $key1 => $value1) {
14+
if ($key1 == 'channel') {
15+
foreach($value1 as $key2 => $value2) {
16+
if ($key2 == 'item') {
17+
foreach($value2 as $key3 => $value3) {
18+
$i++;
19+
if ($i > 1) {
20+
break;
21+
}
22+
23+
$add_array = array();
24+
foreach($value3 as $key4 => $value4) {
25+
if ($key4 == 'pubDate') {
26+
$pubDate = strip_tags($value4);
27+
$pubDate = substr($pubDate, 0, 25);
28+
29+
// Fri, 14 Apr 2017 22:30:01
30+
// yyyy-MM-dd'T'HH:mm:ss'.0Z'.
31+
32+
$yyyy = substr($pubDate, 12, 4);
33+
$MM = substr($pubDate, 8, 3);
34+
$dd = substr($pubDate, 5, 2);
35+
$HH = substr($pubDate, 17, 2);
36+
$mm = substr($pubDate, 20, 2);
37+
$ss = substr($pubDate, 23, 2);
38+
$MM = month_format($MM);
39+
$pubDate = $yyyy . '-' . $MM . '-' . $dd . 'T' . $HH . ':' . $mm . ':' . $ss . '.0Z';
40+
}
41+
42+
if ($key4 == 'title') {
43+
$title = strip_tags($value4);
44+
}
45+
46+
if ($key4 == 'link') {
47+
48+
// $streamUrl=strip_tags($value4);
49+
50+
$redirectionUrl = strip_tags($value4);
51+
}
52+
}
53+
54+
$add_array = array(
55+
array(
56+
"uid" => "urn:uuid:" . $i,
57+
"updateDate" => $pubDate,
58+
"titleText" => $title,
59+
"streamUrl" => $streamUrl,
60+
"mainText" => "",
61+
"redirectionUrl" => $redirectionUrl
62+
)
63+
);
64+
$result_array = array_merge($result_array, $add_array);
65+
}
66+
}
67+
}
68+
}
69+
}
70+
71+
$json = json_encode($result_array);
72+
header("Content-Type: application/json;charset=UTF-8");
73+
echo $json;
74+
exit;
75+
76+
function month_format($MM)
77+
{
78+
switch ($MM) {
79+
case ("Jan"):
80+
$MM = '01';
81+
break;
82+
83+
case ("Feb"):
84+
$MM = '02';
85+
break;
86+
87+
case ("Mar"):
88+
$MM = '03';
89+
break;
90+
91+
case ("Apr"):
92+
$MM = '04';
93+
break;
94+
95+
case ("May"):
96+
$MM = '05';
97+
break;
98+
99+
case ("Jun"):
100+
$MM = '06';
101+
break;
102+
103+
case ("Jul"):
104+
$MM = '07';
105+
break;
106+
107+
case ("Aug"):
108+
$MM = '08';
109+
break;
110+
111+
case ("Sep"):
112+
$MM = '09';
113+
break;
114+
115+
case ("Oct"):
116+
$MM = '10';
117+
break;
118+
119+
case ("Nov"):
120+
$MM = '11';
121+
break;
122+
123+
case ("Dec"):
124+
$MM = '12';
125+
break;
126+
127+
default:
128+
$MM = '12';
129+
break;
130+
}
131+
132+
return $MM;
133+
}
134+
135+
?>

RTS/12h30.png

196 KB
Loading

RTS/matinale (5h-6h30h).php

+135
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
<?php
2+
// Julien Muggli
3+
// Inspired by the work of sitopp, at https://github.com/sitopp/Alexa_FlashBriefing_ArsenalFeed
4+
5+
$rss_url = "https://www.rts.ch/la-1ere/programmes/la-matinale-5h-6h30/podcast/?flux=rss";
6+
$rss_data = simplexml_load_file($rss_url, 'SimpleXMLElement', LIBXML_NOCDATA);
7+
$json = json_encode($rss_data);
8+
$array = json_decode($json, TRUE);
9+
$streamUrl = $array['channel']['item'][0]['enclosure']['@attributes']['url'];
10+
$result_array = array();
11+
$i = 0;
12+
13+
foreach($array as $key1 => $value1) {
14+
if ($key1 == 'channel') {
15+
foreach($value1 as $key2 => $value2) {
16+
if ($key2 == 'item') {
17+
foreach($value2 as $key3 => $value3) {
18+
$i++;
19+
if ($i > 1) {
20+
break;
21+
}
22+
23+
$add_array = array();
24+
foreach($value3 as $key4 => $value4) {
25+
if ($key4 == 'pubDate') {
26+
$pubDate = strip_tags($value4);
27+
$pubDate = substr($pubDate, 0, 25);
28+
29+
// Fri, 14 Apr 2017 22:30:01
30+
// yyyy-MM-dd'T'HH:mm:ss'.0Z'.
31+
32+
$yyyy = substr($pubDate, 12, 4);
33+
$MM = substr($pubDate, 8, 3);
34+
$dd = substr($pubDate, 5, 2);
35+
$HH = substr($pubDate, 17, 2);
36+
$mm = substr($pubDate, 20, 2);
37+
$ss = substr($pubDate, 23, 2);
38+
$MM = month_format($MM);
39+
$pubDate = $yyyy . '-' . $MM . '-' . $dd . 'T' . $HH . ':' . $mm . ':' . $ss . '.0Z';
40+
}
41+
42+
if ($key4 == 'title') {
43+
$title = strip_tags($value4);
44+
}
45+
46+
if ($key4 == 'link') {
47+
48+
// $streamUrl=strip_tags($value4);
49+
50+
$redirectionUrl = strip_tags($value4);
51+
}
52+
}
53+
54+
$add_array = array(
55+
array(
56+
"uid" => "urn:uuid:" . $i,
57+
"updateDate" => $pubDate,
58+
"titleText" => $title,
59+
"streamUrl" => $streamUrl,
60+
"mainText" => "",
61+
"redirectionUrl" => $redirectionUrl
62+
)
63+
);
64+
$result_array = array_merge($result_array, $add_array);
65+
}
66+
}
67+
}
68+
}
69+
}
70+
71+
$json = json_encode($result_array);
72+
header("Content-Type: application/json;charset=UTF-8");
73+
echo $json;
74+
exit;
75+
76+
function month_format($MM)
77+
{
78+
switch ($MM) {
79+
case ("Jan"):
80+
$MM = '01';
81+
break;
82+
83+
case ("Feb"):
84+
$MM = '02';
85+
break;
86+
87+
case ("Mar"):
88+
$MM = '03';
89+
break;
90+
91+
case ("Apr"):
92+
$MM = '04';
93+
break;
94+
95+
case ("May"):
96+
$MM = '05';
97+
break;
98+
99+
case ("Jun"):
100+
$MM = '06';
101+
break;
102+
103+
case ("Jul"):
104+
$MM = '07';
105+
break;
106+
107+
case ("Aug"):
108+
$MM = '08';
109+
break;
110+
111+
case ("Sep"):
112+
$MM = '09';
113+
break;
114+
115+
case ("Oct"):
116+
$MM = '10';
117+
break;
118+
119+
case ("Nov"):
120+
$MM = '11';
121+
break;
122+
123+
case ("Dec"):
124+
$MM = '12';
125+
break;
126+
127+
default:
128+
$MM = '12';
129+
break;
130+
}
131+
132+
return $MM;
133+
}
134+
135+
?>

RTS/matinale (5h-6h30h).png

96.6 KB
Loading

0 commit comments

Comments
 (0)