DEV Community

Gernot Glawe
Gernot Glawe

Posted on

Check external links in PowerPoint automatically from the command line

How do I check whether all my external HTTPs links in the PowerPoints slides are OK? I asked chatgp.

The answer was not right, but it included the idea of just parsing the XML from powerpoint.

So it boiled down to simple steps:

1) Looking in directory ppt/slides/_rels/slide
2) Finding links with xmlquery

elements := xmlquery.Find(doc, "//Relationship")
Enter fullscreen mode Exit fullscreen mode

3) Do a

    response, errors := http.Get(web)
Enter fullscreen mode Exit fullscreen mode

And check it all:

 go run main.go check testdata/someuris.pptx
❌ Target https://www.john-doe.com/ is not reachable in slide: slide3
☑️ Target https://www.google.de/ is reachable in slide: slide3
❌ Target https://www.john-doe.com/ is not reachable in slide: slide2
☑️ Target https://www.google.de/ is reachable in slide: slide2
Enter fullscreen mode Exit fullscreen mode

Use the app: https://github.com/megaproaktiv/linkchecker
With binaries released: https://github.com/megaproaktiv/linkchecker/releases/tag/v0.1.4

Simple as that.
Enjoy!

For more good GO and AWS stuff:
https://www.go-on-aws.com/

Top comments (0)