import system, time, ujson as json, urequests as requests
import uinterface, rgb, wifi

url = 'https://feed2json.org/convert?url=https%3A%2F%2Fnu.nl%2Frss'
if not uinterface.connect_wifi():
  system.reboot()
 
uinterface.loading_text('Fetching news')
response = requests.get(url)
resultjson = json.loads(response.text)

wifi.disconnect()
rgb.clear()

items = resultjson['items']
titles = [item['title'] for item in items]

for i in range(0,20):
  for title in titles:
    uinterface.skippabletext(title)
    rgb.clear()
    time.sleep(1)
    
system.start('nunl')