How to refetch an embedded post

I have embedded discourse on my site (Embedding Discourse Comments via Javascript). Discourse creates posts containing a preview of my site. How can I recreate / refetch such an embedded post as I changed the crawler parameters and I’d like to refetch the preview of the page where discourse is embedded?

Would rebaking help? Is there a command in the console?

I found that


seems to be useful to show what would be fetched.

Looking through the source I found this to be a working solution:

username = SiteSetting.embed_by_username.downcase
user = User.where(username_lower: username.downcase).first
embed_url = "" # or use the url from topic as shown below
TopicEmbed.import_remote(user, embed_url)

taken from TopicRetriever.fetch_http (discourse/topic_retriever.rb at 888e68a1637ca784a7bf51a6bbb524dcf7413b13 · discourse/discourse · GitHub)

where embed_url is the url of the site where discourse is embedded, coming from the topic with the number topic_id this may be

embed_url = TopicEmbed.where(topic: topic_id)[0].embed_url

This seems a bit complicated to just refetch. Is it correct anyway? Is there a simpler possibility?