This week, I finished implementing the feature for filtering out irrelevant feed URLs. Previously, I had added a function for the filtering but had to write the test for it.
As I started writing tests for different feed URLs from different hosts, I noticed that I had missed a few cases. These were the links of type json+oembed
returned by wordpress.com
, and a link returned by blogspot.com
with a rel
attribute value of service.post
. From what I was able to find, this kind of link can be used for adding posts/feeds to the feed. So, I added more filters for these as well.
After some refactoring and testing different regular expressions, I ended up with three filters to handle all irrelevant URLs:
/\/comments\/feed\/$/
/^https:\/\/public-api.wordpress.com\/oembed/
/^https:\/\/www.blogger.com\/feeds\/[0-9]*\/posts\/default$/
The first filter here handles the comments feed from wordpress.com
. I did not specify wordpress
in the regular expression since it would fail if a user had a custom blog URL. However, for the second and third filters, we can specify the blog host as they specify the blog as a query param and a numeric id respectively.
Following that, I had to add more tests, resolve some merge conflicts and do more testing to ensure that the relevant feed URLs were returned for different blog hosts. Once I confirmed that everything worked correctly, I created a PR.
Top comments (0)