Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to new API. Old "chihiro" PSN API is not up to date anymore #13

Open
snipem opened this issue Jan 20, 2022 · 1 comment
Open

Comments

@snipem
Copy link
Owner

snipem commented Jan 20, 2022

Prices differ between chihiro API, which is used for psnprices, and the new web frontend. For example Tearaway:

image

vs.

> psncli -q "Tearaway" --json | jq . | head -n 15
[
  {
    "id": "EP9000-CUSA00562_00-TEARAWAYUNFOLDED",
    "name": "Tearaway™ Unfolded",
    "type": "FULL_GAME",
    "prices": [
      {
        "price": 100,
        "type": "NORMAL"
      }
    ],
    "platforms": [
      "PS4™"
    ]
  },
...

The API call shows no sign of the 9.99 value. I saw the same for other items. For example "Dreams" valued at 100.

We should switch to the newest PSN Store API.

@snipem
Copy link
Owner Author

snipem commented Jul 8, 2022

The PSN api chihiro API seems to be dead for good this time. I created an experimental fix for the new api found in #14.

> psncli -q "ghost of tsushima" --json | jq .
Traceback (most recent call last):
  File "/usr/local/bin/psncli", line 8, in <module>
    sys.exit(psn_main())
  File "/usr/local/lib/python3.9/site-packages/gameprices/cli/cli.py", line 98, in psn_main
    main(Psn("DE/de"))
  File "/usr/local/lib/python3.9/site-packages/gameprices/cli/cli.py", line 73, in main
    print_string = search_for_items_by_name_and_format_output(
  File "/usr/local/lib/python3.9/site-packages/gameprices/cli/cli.py", line 52, in search_for_items_by_name_and_format_output
    items = shop.search(name)
  File "/usr/local/lib/python3.9/site-packages/gameprices/shops/psn.py", line 248, in search
    items = _search_for_items_by_name(name=name, store=self.country)
  File "/usr/local/lib/python3.9/site-packages/gameprices/shops/psn.py", line 171, in _search_for_items_by_name
    data = utils.get_json_response(url)
  File "/usr/local/lib/python3.9/site-packages/gameprices/utils/utils.py", line 17, in get_json_response
    with urllib.request.urlopen(url) as response:
  File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 523, in open
    response = meth(req, response)
  File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 632, in http_response
    response = self.parent.error(
  File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 561, in error
    return self._call_chain(*args)
  File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/usr/local/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 641, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant