You want to get your internet (someone will call public, I don't totally agree on that term) ip address. Basically you have two options, or call an external service (it does not need to be a site like that, it can be a STUN, or anything made for that), or you can get it from your modem/router/NAT.
You could use UPnP if enabled in the device, this is a good approach.
Other option is instead of trying to parse or get the results from an external service,
you get it from your device web page, some devices even not need admin rights to get that information, so you only need to parse the page for the information.
Most of the answers just say you to use an external service, like you said its not a good idea. In my opniation its not the best one, because you be dependent on an external service provider. If it changes anything you need to change too, as if they get the service broken.
So, if you can implement in your own LAN its better, just not easier.