Python Parse RSS Feed With No Dependencies

UPDATED: FEB 8, 2022 | PUBLISHED: FEB 3, 2022 | 667 words, 4 minute read — TIL

I recently wanted to parse an RSS feed as a part of a larger script. Luckily, that boils down to just working with regular-old XML. Despite the proliferation of great libraries like BeautifulSoup, whenever possible I try to stick to the standard library. Not that using Pipenv or another Python dependency tool is necessarily a ton of work, it just feels like excess overhead. Plus, it’s just fun to explore libs I haven’t had the pleasure of interacting with.

Parsing RSS with Python standard library 🔗︎

For my use case, I wanted to parse the RSS file, then pull data from the latest article as well as randomly select a few of the older pieces. The minidom module is our friend for this task, and as always a helpful Stack Overflow led the way .

fiFNraafpffprmIUsrroreoropLMsttriarimoE__iintnr_FdccitlatuirfatxtPEolltiir(raer(mAAmeeetnt'einatflrTT__mlkimdndtie.aHU=idecaucadnRtai=li=r=rltod=Emetn=enaeeumoDimai_'[nrd_rm'nsaitd,]ga.deip=i=rteaenaadmud=temta(dpt)pb3o[im.ar0opaolmr]c.g.t,me.ri.slgeai.nrtcpseetpcNcde/a__tEplUh(mmirdiEleeMoroinsotlen__iavndemeemddFcneie(.mme(aEed(dxFgsen{tA()ro.Ie:nt'aTaamxLttst[UrnmEEsBi0Rtdl_lByt]Ei)'PeyTl)DcAmTae)lTeag':eHngN:_)tNadsamtaBmeitye(taT('l)a'legti,Ninatk'ml'lee)i('[n')0ki[]'t0.:e]fm.il'fri)isnrtksC}th)Cihlidl.dn.ondoedVeaVlauleue

See Also