Easy Polish News
The idea for Easy Polish News came from a similar application I was using to study Japanese, where you could read news in Japanese and get immediate translation for the unknown vocabulary. I thought it would also be a good training project, as it would allow me to try out Azure functions, which is something I had never used before. On that note, I started planning.
The reason to use Azure functions was that the application was extremely simple and did not need a complicated solution. I would also be able to enhance the featureset easily and add more functions if necessary. Initially however, I only needed two functions:
- Timer triggered function to periodically update the news database
- HTTP triggered function used by the app to request news for a specific day
At first, I wanted to use an existing API to fetch the latest news from Polish websites, however I quickly found that there were very few solutions which would allow me to do that, and most of them were very expensive. In the end, there was only one API I could use, but I quickly realised the quality of the news was questionable. I was receiving a lot of irrelevant articles from silly websites which were in no way useful nor interesting. I realised I needed to create my own solution.
The way I approached it is by using an RSS feed from one of the most popular news providers in Poland. The feed allowed me to get a list of titles and URLs to the most recent articles. They also have different feeds for specific categories such as sports, politics and so on, which leaves some room for potential new features in the future.
Using the URLs, I could then scrape the important information using XPATH queries. The HTMLAgilityPack nuget package came in very handy for that purpose. Scraping this information is not really a reliable solution, as my code will stop working the moment the website’s HTML DOM structure changes (OR if they even change elements’ ids), but with no alternatives in sight I decided this was my best option and it was also a good opportunity to learn about XPATH queries (which was surprisingly fun!).
Having all of the necessary information, I could start building a small news database using Azure Blob Storage. My own news feed would then be retrieved by the app using the HTTP triggered function.
The application is written using Xamarin Forms and consists of three screens:
- Newsfeed page
- Article page
- Notebook page
The newsfeed page is probably the most self explanatory, as it is simply displaying the latest news. I also implemented infinite scrolling using Xamarin Forms’ CollectionView where I simply request news for the previous day when the user reaches the end of their current content. There is also a search bar which allows for simple filtering of the fetched articles. In the future, I want to add the previously mentioned categories, which will allow users to choose the content they’re most interested in.
The article page is the most complex one as it features a custom selectable label (implementation described in detail here) to allow the users to select words they do not understand. I then display a view where I show the base form of the word (because Polish is fun like that) and its English translation. Both of these are obtained by scraping dictionary sites, as, again, there was no useful API available. In the future, I would like to build my own dictionary database so I don’t need to rely on third parties and fickle solutions.
The users can choose to save chosen vocabulary which is then displayed on the notebook page. The users can then study and review new words and remove them if needed. It would be a nice addition to have some sort of flashcard or spaced repetition system to help the users test themselves better.
To top it all off I also added notifications to show users new articles and remind them to study!
Easy Polish News was a fun little project to work on and allowed me to learn a lot of new things from Azure through web scraping all the way to custom, OS specific components in Xamarin. As fun as it was, it would be fantastic if it actually benefited someone in their studies so let’s see how that works out :)
After experiencing lots of issues with Xamarin development, I decided to try out Flutter on a small project and decided to rewrite Easy Polish News to this technology. I am now adding new features and improving the project, feeling I am much better equipped to maintain it using better tools. Read more about the rewrite here: I've had enough. Bye, Xamarin!