(Assuming that you don't just want to call web3.eth.getCode()
, and you want something web-based... )
Doesn't appear to be supported by the API, as you've found.
Some horrible scrape-y Python:
#!/usr/bin/env python
import requests
from bs4 import BeautifulSoup
BASE_URL = "https://etherscan.io/address/"
def main():
address = str(input("Please input an address: ").strip())
url = BASE_URL + address
page = requests.get(url)
soup = BeautifulSoup(page.text, 'html.parser')
print(soup.find("div", { "id": "verifiedbytecode2" }).text)
if __name__ == "__main__":
main()
Output:
Please input an address: 0xd26114cd6EE289AccF82350c8d8487fedB8A0C07
6003805460a060020a61ffff0219169055600060045560a0604052600860608190527f4f4d47546f6b656e000000000000000000000000000000000000000000000000608090815261005491600591906100c1565b506040805180820190915260038082527f4f4d4700000000000000000000000000000000000000000000000000000000006020909201918252610099916006916100c1565b5060126007555b60038054600160a060020a03191633600160a060020a03161790555b610161565b828054600181600116156101000203166002900490600052602060002090601f0160209...
Note that the contract must have been verified for this data to be available.
I imagine doing something similar in Node with Cheerio/Axios wouldn't be too difficult.