fixme-lausanne / hackerspaces_ch

The site that was hackerspaces.ch
http://hackerspaces.ch
5 stars 1 forks source link

Scraper can't decode JSON #15

Closed sasha42 closed 8 years ago

sasha42 commented 9 years ago

When trying to run the scraper, the following error appears:

$ python scraper.py 
http://hackerspaces.org/w/api.php?action=ask&query=[[country::Switzerland]]
[[Category:Hackerspace]]&format=json&offset=0
Traceback (most recent call last):
  File "scraper.py", line 163, in <module>
    hs = hackerspaces.get_hackerspaces()
  File "scraper.py", line 84, in get_hackerspaces
    hackerspaces_page = Hackerspaces.get_json(Hackerspaces.country_list(self.country, offset=offset))
  File "scraper.py", line 63, in get_json
    return resp.json()
  File "/Library/Python/2.7/site-packages/requests-2.7.0-py2.7.egg/requests/models.py", line 819, in json
    return json.loads(self.text, **kwargs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 365, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 383, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

It seems that hackerspaces.org automatically redirects to https. When I tried changing the URL to https, the parser claimed that there was an issue with tag mismatches:

XMLSyntaxError: Opening and ending tag mismatch: hr line 5 and body, line 6, column

According to a question on stackexchange, this appears to be an issue with hs.org's JSON formatting.

gcmalloc commented 9 years ago

I have a 500 when hitting hackerspaces.org

should be wiki.hackerspaces.org

gcmalloc commented 8 years ago

fixed by f3c63cba13fabf18606bf5d73343588ba00b9699