Change max chars in Onebox - enlarge your Onebox?

Ahh, dooh.

It seems like the source that the script rip data from by standart only contains 250 chars

If you eg. go to

https://www.amazon.com/gp/aw/d/0323353177/

And view it as user agent:

Mozilla/5.0 (iPhone; CPU iPhone OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A405 Safari/7534.48.3

The div with productDescription only contains 250 chars.

If you press the field you go to a new page with the path

https://www.amazon.com/gp/aw/d/0323353177/#productDescription_secondary_view_div_1520843164890

Here you have the full description inside the div productDescription_fullView

It should have a xpath

//*[@id="productDescription_fullView"] 

A dirty solution in: onebox/lib/onebox/engine/amazon_onebox.rb at main · discourse/onebox · GitHub

Find the empty line 85 add

      description = raw.at_css('#productDescription_fullView')&.inner_text

Change line 104

        description: raw.at("#productDescription")&.inner_text,

to

        description: description,

To have something like that

2 Likes