Public
Edited
Jun 12, 2024
1 fork
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
lastpodcasts = await getRSS(url)
Insert cell
// lastpodcastsurl = lastpodcasts.map((d) => `https://www.radiofrance.fr${d}`)
Insert cell
results = await Promise.all(lastpodcasts.map(async (d) => await getPeople(d)))
.then((d) => d.flat())
.then((d) => aq.from(d))
Insert cell
query = `
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX schema: <http://schema.org/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT ?item ?itemLabel
?radiofrance WHERE {
?item wdt:P10780 ?radiofrance.
?item rdfs:label ?itemLabel.
FILTER((LANG(?itemLabel)) = "${lang}")} `
Insert cell
data = fetch(
`https://query.wikidata.org/sparql?query=${encodeURIComponent(query)}`,
{ headers: { accept: "application/sparql-results+json" } }
).then((response) => response.json())
Insert cell
array = aq.from(
data.results.bindings.map((d) => ({
item: d.item.value,
itemLabel: d.itemLabel.value,
radiofrance: d.radiofrance.value
}))
)
Insert cell
match = results
.join_left(array, ["people", "radiofrance"])
.derive({ radiofrance: (d) => `<a href="${d.url}"> ${d.people}` })
.derive({
wikidata: (d) =>
`<a href="${d.item}"> ${d.itemLabel} (${op.replace(
d.item,
"http://www.wikidata.org/entity/",
""
)})`
})
.derive({
radiofrance2: (d) =>
`<a href="https://www.radiofrance.fr/personnes/${d.people}"> ${d.people}`
})
.orderby(aq.desc("date"))
Insert cell
import { getPeople } from "@pac02/how-to-get-the-list-of-participants-to-a-radio-program"
Insert cell
import { aq, op } from "@uwdata/arquero"
Insert cell
import { getPodcasts } from "@pac02/radio-france-podcast"
Insert cell
import { getRSS } from "@pac02/get-rss-from-radiofrance"
Insert cell
moment = require("moment")
Insert cell
moment.locale("fr", {
months:
"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split(
"_"
),
monthsShort:
"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),
weekdays: "dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),
weekdaysShort: "dim._lun._mar._mer._jeu._ven._sam.".split("_"),
weekdaysMin: "di_lu_ma_me_je_ve_sa".split("_")
})
Insert cell
get_default = () => {
const params = new URL(document.URL).searchParams;
const defaults = {
url: "https://radiofrance-podcast.net/podcast09/rss_10239.xml",
lang: "fr"
};
if (params.has("url")) {
defaults.url = params.get("url");
}
if (params.has("lang")) {
defaults.lang = params.get("lang");
}
return defaults;
}
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more