Tasos Tasos - 1 year ago 132
Python Question

Python Goose cannot extract date

I am using Python Goose. You can find it in this link

I want to extract the published date, but when I run the:

g = Goose()
entity = g.extract(url="mylink")
date = entity.publish_date

I have as a result

I have tried it in many many sites and results were

Any advice?

Answer Source

I have just checked the relevant part of the source: crawler.py The publish_date extraction is currently commented out

# article.publish_date = config.publishDateExtractor.extract(doc)

Further examination revealed that if you uncomment the line above, you'll be able to define your custom date extractor. However, there is no default date extractor implemented in Goose. See this method: set_publishdate_extractor in https://github.com/grangier/python-goose/blob/master/goose/configuration.py

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download