In theory, it should be just a matter of fetching /tor/rendezvous2/<hidden service identity> via HTTP from the hidden service directory responsible for that hidden service, as per the rend spec, in particular section 1.6.
In practice, you need to find the right server to download it from and then form the request correctly. That's a bit icky to do manually. There is a script by DonnchaC, retrieve_hs_descriptor, which depends on Stem and helps with that part.
As an example, right now the descriptor for the DuckDuckGo hidden service can be found, among other places, at
http://64.31.47.121:9030/tor/rendezvous2/yj446zqor4cczgxzl3kgtmdbfgwkj6de
and looks like this:
rendezvous-service-descriptor yj446zqor4cczgxzl3kgtmdbfgwkj6de version 2 permanent-key -----BEGIN RSA PUBLIC KEY----- MIGJAoGBAJ/SzzgrXPxTlFrKVhXh3buCWv2QfcNgncUpDpKouLn3AtPH5Ocys0jE aZSKdvaiQ62md2gOwj4x61cFNdi05tdQjS+2thHKEm/KsB9BGLSLBNJYY356bupg I5gQozM65ENelfxYlysBjJ52xSDBd8C4f/p9umdzaaaCmzXG/nhzAgMBAAE= -----END RSA PUBLIC KEY----- secret-id-part a2pcyuhciqsrah34benwufa54aandwzh publication-time 2013-10-01 15:59:47 protocol-versions 2,3 introduction-points -----BEGIN MESSAGE----- aW50cm9kdWN0aW9uLXBvaW50IGkzdWJoazQzc3RranZlenpmZmlnaXc3ZzRmbmV4 bHI3CmlwLWFkZHJlc3MgNzguNDYuNTEuMjMzCm9uaW9uLXBvcnQgNDQ0Cm9uaW9u LWtleQotLS0tLUJFR0lOIFJTQSBQVUJMSUMgS0VZLS0tLS0KTUlHSkFvR0JBTWpz NnZZRmhURWI0U1dTNzd3K3pvMEVrMDFub083cU1aODU0cEtadEt4T2pDSGF1bGhK V29sTApnYlZwZnpQQVpZeVhoSUJkRW9tK2dabDFyZXhrRE9nTmt2eXNBMHd3cmNS dk5waklUM3dVYVFhdHlIczIrSnZVCmhzMitzZVY1OXQ2dEZER2VESVdJRHRQVmE0 Q2ZCbUNzSFpiU09aQVFHeUVyNEdHOG9HRjNBZ01CQUFFPQotLS0tLUVORCBSU0Eg UFVCTElDIEtFW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cbl4KUX EUUkJ3hXhmB3gFAjUkk70IDr5HIP86Z/ZTl6WvbTFWYLUPJQtt08XSmY788FG1lA nTnNbqms5Nt5HKsG5khZf5viIuU3ei+u0SIv3gHy3JY= -----END SIGNATURE-----
Note that for servers running a Tor version 0.2.4.x or 0.2.3.23 or later, the answer is even trickier. Such servers, when acting as hidden service directories, will require these HTTP requests to be done via an encrypted connection, i.e. over Tor and not using plain-text HTTP. So that makes it a bit more tricky. The easiest approach might be to modify Tor and have it dump HS descriptors when you fetch them.
Otherwise you could use Stem get_hidden_service_descriptor function. The following python script will print the HS descriptor for the onion address passed as command line parameter.
import sys
from stem.control import Controller
with Controller.from_port(port = 9051) as controller:
controller.authenticate()
print(controller.get_hidden_service_descriptor(sys.argv[1]))