"Onebox Assistant", crawl for those previews reliably!

I have the same settings. It works for me. Sorry, don’t know the reasons you can’t make it working.

:frowning: Is there any way to troubleshoot or debug the plugin to see why this is happening?

It’s working for me, perfectly, on a recent rebuild. Can you share the link you are trying to show?

Remember, if you’ve previously attempted to onebox a link, Discourse core will cache the result.

You can add a random querystring on the end to overcome the cache: https://mylink.com/todaynews?random=random

You can also check the API is responding with, e.g.:

curl -X GET "https://api.embed.rocks/api/?url=https%3A%2F%2Fnews.bbc.co.uk%0A&skip=article,description,oembed,imextra&include=source" -H "x-api-key: %%%your-api-key%%%"

Do this from your server.

You need to url encode the site you are calling (the url parameter value) using some site like this (not vouched for!)

3 Likes

Thanks for the in-depth post!

However, it… was fixed without me doing anything special. I had to install another plugin, so I rebuilt Discourse, and it started working shortly after that. I don’t know if that was what fixed the issue, but if it happens again I’ll follow your directions for sure :slight_smile:

2 Likes

I don’t know how to install this plugin, can you write a simple method? @merefield

Thank you!

1 Like

Same as any other plugin, see: Install Plugins in Discourse

I’ve updated the OP to make that more obvious :slight_smile:

1 Like

Thanks! I have installed this plugin in my meta, but I found that onebox still can’t support twitter, I mean the preview card can’t be shown after I pasted the twitter link… Youtube and other website links works!

This plugin needed a big update based on the recent refactor in core about 2 weeks ago.

Here it is, should be working now:

https://github.com/merefield/discourse-onebox-assistant/commit/682fdf028114fb4f0364d2b68434d6e067d0ebde

1 Like

Love the plugin @merefield! Just wanted to point out that if you paste a link into the composer, the title takes a while to update - compared to without the plugin (as an example it took a youtube link 5-10 seconds vs pretty much instantly.without the plugin). Is there a way the title could be fetched in the usual way?

It naturally takes longer because you are reaching out to a third party crawler API.

That call will be faster if the API has cached the result. If it’s novel for the API it will take longer. Nothing we can do about that.

Not sure how that would work? The title also comes from a scrape of the target via the crawler API.

1 Like

Ah ok. I thought the third party crawler could fetch the image and the rest could be done by the in built crawler.

Its only function is to fetch the target page source so it can pass that to Onebox to do its thing.

2 Likes

I’ve pushed a couple of core compatibility fixes for this, and a settings bug fix :bug: cheers! :hammer_and_wrench:

4 Likes

Seems like this plugin making all oneboxes return 404s for the GET /onebox route now. I rebuild my site with the plugin disabled and onebox is working again. Disabling thru the admin panel didn’t seem to help…

2 Likes

Interesting. It’s working with Commits · discourse/discourse (github.com)

Breaking change in last couple of days?

1 Like

It could be my setup, we were on Commits · discourse/discourse · GitHub before I rebuilt…

1 Like

No, I believe you are correct. That’s really useful, even more recent, reduces the search :+1:

1 Like

I had the same issue, and I also believed it was resolved by uninstalling completely the plugin. Disabling it didn’t fix it.

I believe it was, in fact, because I uninstalled the onebox assistant. It has been some days ago and I can’t be 100% sure, but my issue was identical to yours, so…

Also, it is possible that my screenshot of installed plugins falsely shows what plugins were actually installed when the issue occurred. What I’m sure of is that the issue didn’t resolve after just rebuilding, onebox assistant was disabled for more than a year, and I didn’t do anything else than remove it from app.yml. I might have taken the screenshot after this rebuild and before testing again…

2 Likes

Due to the nature and complexity of the overrides, the “disabling” of the setting removes the assistance but does not remove the overrides themselves.

The plugin can be a little fragile, there is little that can be done for that (without potentially PRing a change of structure to core), though you’ve seen that it can work for quite long runs at a time without intervention, as those overrides were being applied the whole time it was installed.

You can see what the setting does by reading the code.

1 Like

Not related, but I used the plugin when rebaking all my posts after a huge import (1,6 M posts), including posts containing Youtube videos. Youtube ended by blacklisting my IP after too much embedding. Installing and enabling Onebox Assistant resolved this issue, and I didn’t need it after the rebake. I disabled it but didn’t remove it (just in case, you know). It was perfect for this task.

4 Likes