lschmid83 / 12-Step-Recovery-Guide

This is an Android app written in Java and Android Studio. It provides 12-Step reading materials, daily quotes, meditations, motivational images, a meeting map and speaker tapes.
https://www.citexsoftware.co.uk/recovery-meeting-finder
44 stars 0 forks source link

Daily Reflection on the Home fragment always displays Jan 01 reading #27

Closed lschmid83 closed 3 months ago

lschmid83 commented 3 months ago

I have already implemented the code to retrieve the daily reflection from the https://www.aa.org/daily-reflections website. For some reason currently it only displays the reading stuck on Jan 1st. It was working fine previously it appears they have redesigned the website. The code needs to be fixed and can be found under ui/home/thought_for_the_day/DailyReflectionFragment.java

lschmid83 commented 3 months ago

The https://www.aa.org/daily-reflections page had been redesigned to only display the Jan 1st reading on page load then make an AJAX call to retrieve the reading of the day. After inspecting the web page in Chrome developers tools I found they have an API method https://www.aa.org/api/reflections/06/05 which accepts the month and day for the reading. This returns a JSON object with a data string that contains the HTML. I request this using the Volley library and parse it into a JSoup HTML document object. The actual HTML structure had not changed so I was able to reuse the existing code to parse the document for the required elements.