I am using Goose for extracting the title and main text from various URLs. It works with most of the URLs except one specific Dutch news website. Any idea whats going wrong here?
The specific problematic URL is here.
My code:
g = Goose()
content_url = g.extract(url=url)
allcontent = content_url.cleaned_text
print allcontent
I was expecting the whole text but strangely I just get the following paragraph from the article at a random point.
Toerisme was een groot goed toen het een voorrecht was van de elite. Maar nu de massa in het voetspoor treedt van Floortje Dessing gaat het van kwaad tot erger. Het verplaatsen van mensen per cruiseboot of jumbojet is milieubelastend. Toeristen die de bloemetjes buiten zetten, veroorzaken geluidsoverlast in de kleine uurtjes. Toeristenplaatsen veranderen buiten het seizoen in spookoorden. En een bezoek aan de yakherders in Mongolië is een stuk minder interessant als blijkt dat de buren er twee maanden eerder ook waren geweest.
The problem is in 2 reasons:
The way Goose is calculating 'main content' sitting html element, specifically it tries to find text chunk then moves upward in html tree and updates scores for each enclosing element. As an output you receive the most valued element based on internal scoring.
Your webpage structure. If you inspect html you will see article text is placed in several different html blocks, so Goose is selecting one of them.
Solution depends, if your goal is to parse this single site you would be better of using modules like beautiful soup, lxml, grab etc to parse text blocks individually and merging them together. In case you have millions sites to crawl, just live with what goose is giving you out of the box.