Skip to content

category of an article #15

Closed
Closed

Description

@littleyoda

Describe the bug

Unsurprisingly, the function “def get_article_category(self, article_id: str)” no longer works.

I have already looked through the entire JSON returned by “/pages/product-details-page-root?id={article_id},” but I haven't found any clues as to a category.

Does anyone have any idea how I can get the category of an article with the current api?

Steps to reproduce the issue

Use get_article_category with any article

What did you expect to happen instead?

Should returns the name of the categorie

Python Version

3.11

Activity

  1. added
    bug
    on Sep 6, 2025
  2. codesalatdev commented on Sep 6, 2025

    @codesalatdev
    Owner

    I seem to have forgotten about this function. Requesting a category together with an article's data raises a NotImplementedError so this is just a leftover. This was broken ever since I forked the library and when wanting to fix it, I too couldn't find any endpoint or reference to a category, so I just left it at that.

  3. littleyoda commented on Sep 6, 2025

    @littleyoda
    Author

    Small update:

    If you add "show_category_action=true" to the article url, the Json-File contains some category information:

     "onPress": {
         "actionType": "OPEN",
         "target": "app.picnic://categories/19362/l2/19431/l3/19769"
    },
    
    

    path = f"/pages/product-details-page-root?id={article_id}&show_category_action=true"

    I tried to a request, without success.
    p._get("/categories/19362/l2/19431/l3/19769", add_picnic_headers=True)

    Unfortunately, I don't have any idea what else I can do with the information at the moment.

  4. littleyoda commented on Sep 6, 2025

    @littleyoda
    Author

    Using the information from p.get_categories(), you can translate at least the first two levels ( 19362 and 19431)

  5. codesalatdev commented on Sep 6, 2025

    @codesalatdev
    Owner

    Small update:

    If you add "show_category_action=true" to the article url, the Json-File contains some category information:

     "onPress": {
         "actionType": "OPEN",
         "target": "app.picnic://categories/19362/l2/19431/l3/19769"
    },
    

    path = f"/pages/product-details-page-root?id={article_id}&show_category_action=true"

    I tried to a request, without success. p._get("/categories/19362/l2/19431/l3/19769", add_picnic_headers=True)

    Unfortunately, I don't have any idea what else I can do with the information at the moment.

    That's a big update! :D I will get my PicNic-Phone operational again and see what I can find. Thank you so far!

    Translating the first two levels would definitely be a fallback.

  6. codesalatdev commented on Oct 3, 2025

    @codesalatdev
    Owner

    The function get_category_by_ids has been added and get_article can now be used with the parameter add_category = True to also retrieve the category data. See #20 (comment)

    If you have a use-case where returning the Level 1 category could be useful, please open a new issue for that.
    Thank you for bringing this up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions