Sign In

Temporary Solution for the Issue of "Preview Images of Scheduled Models Not Displaying"

0
Temporary Solution for the Issue of "Preview Images of Scheduled Models Not Displaying"

Currently, there is a bug in Civitai that prevents the preview images of models scheduled for release from being displayed correctly.

Detailed information about this bug has been recorded and submitted to the official team here: Bug Tracker - Can't see any images except for the gallery on the bottom part of pages. In summary, when you schedule a model version for release and then enter the model page to click "publish" to release it early, the post still remains in the scheduled state. As a result, the post remains hidden, and other users cannot view it. Like this

图片We have recently found a temporary solution to this problem using web scraping techniques. The code provided below is written in Python and requires you to obtain your own Civitai account's cookie information using tools like Selenium to ensure you have permission for the following operations:

import requests

# You need to get your own Civitai session with Selenium
session: requests.Session = get_civitai_session()

model_id = 130887  # your model id
post_id = 562894   # your post id

resp = session.post(
    'https://civitai.com/api/trpc/post.update',
    json={
        'json': {
            'id': post_id,
            'authed': True,
            # this time is now
            "publishedAt": '2023-09-09T04:36:15.688057+00:00',
        },
        "meta": {
            "values": {
                "publishedAt": ["Date"]
            }
        }
    },
    headers={'Referer': f'https://civitai.com/models/{model_id}/wizard?step=4'},
)
resp.raise_for_status()

The code above can override the publishedAt field of the post, allowing it to be displayed immediately.

This script has been used on approximately 50 models that previously experienced this issue, and image display has been confirmed to have returned to normal.

0

Comments