I know nothing of karate beyond what I have seen in movies, but I would guess that one of the philosophies behind it is “simpler = better”.

My karate non-knowledge did not stop me from using the metaphor in a post where I thought I was being clever to using some Google Spreadsheets to extract opengraph meta data from Kaltura video URLs (to get the direct link to the video’s mp4, which I noted was buried in the page’s opengraph metadata).

I went to use it last week to help a project participant for in the H5P / PB Kitchen. The problem was my reliance in the first spreadsheet on a third party site https://opengraphcheck.com/ that I had found could take a URL and return as results the opengraph tags. That site seems DOA, so all my formulas broke.

Thus, in about 15 minutes of sleeve rolling, web searching on “Xpath google sheets opengraph” (got an assist from this blog I was leaving out the single quotes on the property name), I got it done more directly.

For anyone who cares, the original spreadsheet was updated, so you can just get a new copy (toss the first one), and get back to extracting Kaltura video mp4 links that the display pages themselves do not provide (this is all about using Kaltura in the H5P Interactive Video content type).

And for reference, the initial function that broke (it references the named cell that contains the URL for a Kaltura Video) looked like:

= IMPORTXML("https://opengraphcheck.com/result.php?
url="&ENCODEURL(kaltura_url),"//table/tbody/tr[7]")

Which of course died when https://opengraphcheck.com/ went offline or wherever dead websites go. This is the much cleaner function, that does it directly:

= IMPORTXML(kaltura_url,"//meta[@property='og:video']/@content")

Simpler, in Xpath queries, is a better move. Apologies to anyone who used that first spreadsheet, I am embarrassed by the lame approach I took.

Chop!


Image Credit: Noun Project icon Karate by The Pyramid School licensed Creative Commons CC BY superimposed in a screenshot of my own Google Spreadsheet (H5P blue color added to the karate dude).

If this kind of stuff has value, please support me by tossing a one time PayPal kibble or monthly on Patreon
Become a patron at Patreon!
Profile Picture for CogDog The Blog
An early 90s builder of web stuff and blogging Alan Levine barks at CogDogBlog.com on web storytelling (#ds106 #4life), photography, bending WordPress, and serendipity in the infinite internet river. He thinks it's weird to write about himself in the third person. And he is 100% into the Fediverse (or tells himself so) Tooting as @cogdog@cosocial.ca

Leave a Reply

Your email address will not be published. Required fields are marked *