PageSourceSearch

https://palermo-huila.gov.co/SiteAssets/v1/assets/components/home/actualidad/api.js

js palermo-huila.gov.co collected 2026-10-02 00:06:00 UTC 3,304 bytes, 135 lines download raw bytes

1const getNoticias = async () => {
2  const url = "/sp_api.aspx?ref=get-list-items";
3  const body = {
4    fields: [
5      "ID",
6      "Title",
7      "FileRef",
8      "Comments",
9      "PublishingPageImage",
10      "ArticleStartDate",
11      "Categoria",
12      "Hashtags",
13    ],
14    site: "/NuestraAlcaldia/SaladePrensa",
15    list: "Páginas",
16  };
17
18  const response = await fetch(url, {
19    method: "POST",
20    headers: {
21      "Content-Type": "application/json",
22    },
23    body: JSON.stringify(body),
24  });
25
26  if (!response.ok) {
27    throw new Error("Network response was not ok");
28  }
29
30  const data = await response.json();
31  if (data.status !== "ok") {
32    throw new Error("Error fetching data: " + data.message);
33  }
34
35  return data.data
36    .filter((item) => item.Title !== "inicio")
37    .sort((a, b) => new Date(b.ArticleStartDate) - new Date(a.ArticleStartDate))
38    .slice(0, 3);
39};
40
41const getImgAdicional = async (idNoticia) => {
42  const url = "/sp_api.aspx?ref=get-list-items";
43  const body = {
44    fields: ["FileRef", "idNoticia"],
45    site: "/NuestraAlcaldia/SaladePrensa",
46    list: "ImagenesNoticias",
47  };
48
49  const response = await fetch(url, {
50    method: "POST",
51    headers: {
52      "Content-Type": "application/json",
53    },
54    body: JSON.stringify(body),
55  });
56
57  if (!response.ok) {
58    throw new Error("Network response was not ok");
59  }
60
61  const data = await response.json();
62  if (data.status !== "ok") {
63    throw new Error("Error fetching data: " + data.message);
64  }
65
66  return data.data
67    .filter((item) => item.idNoticia === idNoticia)
68    .map((item) => ({
69      title: item.Title,
70      fileRef: item.FileRef,
71    }));
72};
73
74const getComentsCount = async (idNoticia) => {
75  const url = "/sp_api.aspx?ref=get-list-items";
76  const body = {
77    fields: ["idNoticia"],
78    site: "/NuestraAlcaldia/SaladePrensa",
79    list: "Comentarios",
80  };
81
82  const response = await fetch(url, {
83    method: "POST",
84    headers: {
85      "Content-Type": "application/json",
86    },
87    body: JSON.stringify(body),
88  });
89
90  if (!response.ok) {
91    throw new Error("Network response was not ok");
92  }
93
94  const data = await response.json();
95  if (data.status !== "ok") {
96    throw new Error("Error fetching data: " + data.message);
97  }
98
99  return data.data.filter((item) => item.idNoticia === idNoticia).length;
100};
101
102const getReactions = async (idNoticia) => {
103  const url = "/sp_api.aspx?ref=get-list-items";
104  const body = {
105    fields: ["idNoticia", "Likes", "Dislikes"],
106    site: "/NuestraAlcaldia/SaladePrensa",
107    list: "Reacciones",
108  };
109
110  const response = await fetch(url, {
111    method: "POST",
112    headers: {
113      "Content-Type": "application/json",
114    },
115    body: JSON.stringify(body),
116  });
117
118  if (!response.ok) {
119    throw new Error("Network response was not ok");
120  }
121
122  const data = await response.json();
123  if (data.status !== "ok") {
124    throw new Error("Error fetching data: " + data.message);
125  }
126
127  return data.data
128    .filter((item) => item.idNoticia === idNoticia)
129    .map((item) => ({
130      likes: item.Likes || 0,
131      dislikes: item.Dislikes || 0,
132    }));
133};
134
135export { getNoticias, getImgAdicional, getComentsCount, getReactions };

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.