Skip to content

Instantly share code, notes, and snippets.

@brainno722
brainno722 / WikipediaWiget.js
Created October 5, 2020 08:35 — forked from rsalzer/WikipediaWiget.js
Code for a widget for the Scriptable-App (iOS) which shows you random wikipedia previews
const lang = "en" //use the language of your choice "en", "de", "it", "fr", etc.
const url = `https://${lang}.wikipedia.org/api/rest_v1/page/random/summary`
const req = new Request(url)
const res = await req.loadJSON()
const i = new Request(res.thumbnail.source);
const img = await i.loadImage();
let widget = createWidget(res.title, img, res.content_urls.mobile.page)
if (config.runsInWidget) {
// create and show widget
const getURL = year => `https://nolaborables.com.ar/api/v2/feriados/${year}`
const months = ['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'];
const days = ['Domingo', 'Lunes', 'Martes', 'Miercoles', 'Jueves', 'Viernes', 'Sabado'];
const dayOfWeek = (day, month, year) => days[new Date(year, month, day).getDay()];
const getYear = () => (new Date()).getFullYear();
const getNextHoliday = function(holidays){
const now = new Date()