molybdenum-99 / infoboxer

Wikipedia information extraction library
MIT License
174 stars 16 forks source link

When pulling a category MediaWiki#list fails #93

Open delonnewman opened 1 year ago

delonnewman commented 1 year ago

When pulling the category as shown below:

Infoboxer.wikipedia('en').category('Category:Census-designated places in California')

I get the following error: 'block in list': undefined method 'first' for nil:NilClass (NoMethodError)

The stack trace points here:

https://github.com/molybdenum-99/infoboxer/blob/b1770d0d85a4c6db315a3fb8c6b20cae31e08738/lib/infoboxer/media_wiki.rb#L244

After doing some digging the issue seems to be that the page data for many of the pages listed in that category don't have a 'revisions' key, hence the error. I don't know enough about the MediaWiki APIs to propose a fix. But, I figured I'd start by reporting the issue here.

Thanks for your work!

Ruby Version: 3.0.4 Infoboxer Version: 0.4.0

zverok commented 1 year ago

Thanks for the report, I'll try to look into it in the upcoming days