There is same question on stackexchange but the answer to that question does not include the new api on etherscan which, given an address as input, allows you to download source code of that verified smart contract.
But I want to download source code of a random verified contracts without knowing its address.
My ultimate goal is to make folders based on versions of contracts and download 50-100 for each version if available enough. I also want to know how many verified smart contracts are there on etherscan so that i can estimate time of download as only last 500 verified contracts are visible on etherscan.
edit: If I know addresses of verified smart contract then the api will work since i can loop over all addresses. Is there any way to get a list of addresses of all verified smart contracts?