ClementJ18 / moddb

A Python scrapper to access ModDB mods, games and more as objects
https://moddb.readthedocs.io
MIT License
13 stars 8 forks source link

File.get_mirrors regexp is too strict, fails to match in some examples #25

Closed karthanistyr closed 1 year ago

karthanistyr commented 1 year ago

The regexp: r"(.*) #([0-9]*) \((.{2}), (.{2})\)" fails to match some mirror lines, e.g. "DBolical EU #3 (FRANKFURT, DE)"

The 'city' part is not always 2 characters long, sometimes it's more (i.e. FRANKFURT as in the example above).

image

This breaks File.get_mirrors which then crashes.

Traceback (most recent call last):
  File "/home/karthanis/Documents/lutris/moddb_test/toto.py", line 7, in <module>
    mirrors = f.get_mirrors()
  File "/home/karthanis/Documents/lutris/moddb_test/venv/lib/python3.10/site-packages/moddb-0.8.0-py3.10.egg/moddb/pages/file.py", line 181, in get_mirrors
    name=mirror_match.group(1),
AttributeError: 'NoneType' object has no attribute 'group'
karthanistyr commented 1 year ago

@ClementJ18 hi, please note that I'd like this merged before long so that we can move forward with https://github.com/lutris/lutris/pull/4711 :pray:

karthanistyr commented 1 year ago

Thanks for the quick turnaround, will you consider releasing a bugfix on pypi too ?

ClementJ18 commented 1 year ago

In progress, just need to wrap up a few things

ClementJ18 commented 1 year ago

@karthanistyr https://pypi.org/project/moddb/0.8.1/

Thanks for the report and PR