From 92a98c13ebf58396d0798cd9cfd7097258eb5196 Mon Sep 17 00:00:00 2001 From: quenousimporte Date: Thu, 6 Jun 2024 11:42:42 +0200 Subject: [PATCH] remove useless script --- lemonde.js | 61 ------------------------------------------------------ 1 file changed, 61 deletions(-) delete mode 100644 lemonde.js diff --git a/lemonde.js b/lemonde.js deleted file mode 100644 index c01d253..0000000 --- a/lemonde.js +++ /dev/null @@ -1,61 +0,0 @@ -// open https://journal.lemonde.fr, open an issue, hit f12 and find the GetPublicationContentItems url - -var url = "https://lmo-lmo-production-cdn.twipecloud.net/lmo/lmo/contentPackages/3761/GetPublicationContentItems-5274.json?v=20240524113722&Policy=eyJTdGF0ZW1lbnQiOiBbeyJSZXNvdXJjZSI6Imh0dHBzOi8vbG1vLWxtby1wcm9kdWN0aW9uLWNkbi50d2lwZWNsb3VkLm5ldC9sbW8vbG1vL2NvbnRlbnRQYWNrYWdlcy8zNzYxLyoiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE3MTY1NTg4MzF9LCJJcEFkZHJlc3MiOnsiQVdTOlNvdXJjZUlwIjoiMC4wLjAuMC8wIn0sIkRhdGVHcmVhdGVyVGhhbiI6eyJBV1M6RXBvY2hUaW1lIjoxNzE2NTU2OTcxfX19XX0_&Signature=gfKT8bLNWoohcNqbvA7A~UKZMSLIJxLuPo5sJFtG1lmXwWfTl~3Y4RmgDn00uZ4VIW6uRJJFEIldrL9iBbUMY7LgtiDOpBxj5zPv-UBqN8mkxUkdd7OBPtAypz~7lByyx92or6VzOUzkMYEZ-ptPHVWyUon4Jv1BudMTxmWa1Vg_&Key-Pair-Id=APKAJZKKWCWU2JPGEHQQ"; -var booktitle = "Le Monde 28 mai"; -var output = ""; -var toc = ""; - -function sanitize(s) -{ - return s.replace(/<[^>]*>?/gm, ''); -} - -fetch(url) -.then(r => r.json()) -.then(publication => - { - publication - .Content - .filter(article => article.Category == "Le Monde") - .sort( (a,b) => a.PageNumber - b.PageNumber) - .forEach(article => - { - var contentitem = article.ContentItem.find(i => i.ContentType == "text/xml"); - var title = contentitem.Title; - if (title) - { - title = sanitize(title); - var category = sanitize(contentitem.SubTitle).trim(); - var id = article.ContentID; - var page = article.PageNumber; - - output += "

" + title + "

"; - if (category) - { - output += "

" + category + "

"; - } - output += contentitem.HtmlText; - - if (page > 1) - { - output += "

Retour

"; - - toc += "" + title + "" - if (category) - { - toc += " (" + category + ")"; - } - toc += "
"; - } - } - }); - - console.log("" + booktitle + "" - + "

Sommaire

" - + "
" + toc + "
" - + output - + ""); - } -); - -