Where does Aristotle or St. Thomas Aquinas say we know substances by means of their accidents?
For example: To know the substance of an apple, I first have to sense its quantity and qualities: shape, color, size, weight, etc.
Probably the best quote, Posteriora Analytica l. 13 n. 7:
…quia formæ essentiales non sunt nobis per se notæ, oportet quod manifestentur per aliqua accidentia, quæ sunt signa illius formæ, ut patet in VIII Metaphys. Non autem oportet accipere accidentia propria illius speciei, quia talia oportet per definitionem speciei demonstrari; sed oportet notificari formam speciei per aliqua accidentia communiora; et secundum hoc differentiæ assumptæ dicuntur quidem substantiales, in quantum inducuntur ad declarandum formam essentialem, sunt autem communiores specie, in quantum assumuntur ex aliquibus signis, quæ consequuntur superiora genera.
…because the essential forms are not known to us per se, they must be disclosed through certain accidents which are signs of that form, as is stated in Metaphysics VIII [1042b9-1043a28: "Form Inferred from Accidental Differences in Sensible Substances"]. However, one should not take the proper accidens of that species, because they are the ones that will be demonstrated by the definition of the species; rather the form of the species must be made known by certain accidents that are more common. Hence according to this, the differences which are used are indeed called substantial, inasmuch as they are adduced in order to declare the essential form; but they are more common than the species, inasmuch as they are taken from signs which follow upon higher genera.
In rebus enim sensibilibus etiam ipsæ differentiæ essentiales nobis ignotæ sunt, unde significantur per differentias accidentales, quæ ex essentialibus oriuntur, sicut causa significatur per suum effectuum
For even in the case of sensible things, the essential differences themselves are not known; whence they are signified through accidental differences which rise out of the essential ones, as a cause is signified through its effect
De Spirit. Creaturis, a. 11, ad 3:
Formæ substantiales per seipsas sunt ignotæ; sed innotescunt nobis per accidentia propria. Frequenter enim differentiæ substantiales ab accidentibus sumunutr, loco formarum substantialum quæ per huiusmodi accidentia innotescunt; sicut bipes et gressibile et hujusmodi; et sic etiam sensibile et rationale ponuntur differentiæ substantiales.
because substantial forms in themselves are unknown but become known to us by their proper accidents, substantial differences are frequently taken from accidents instead of from the substantial forms which become known through such accidents; as, for example, "biped" and "able to walk" and the like; and so also "sensible" and "rational" are put down as substantial differences.
ST I, 29, 1, ad 3
quia substantiales differentiæ non sunt nobis notæ, vel etiam nominatæ non sunt, oportet interdum uti differentiis accidentalibus loco substantialium, puta si quis diceret, ignis est corpus simplex, calidum et siccum, accidentia enim propria sunt effectus formarum substantialium, et manifestant eas. Et similiter nomina intentionum possunt accipi ad definiendum res, secundum quod accipiuntur pro aliquibus nominibus rerum quæ non sunt posita. Et sic hoc nomen individuum ponitur in definitione personæ, ad designandum modum subsistendi qui competit substantiis particularibus.
Substantial differences being unknown to us, or at least unnamed by us, it is sometimes necessary to use accidental differences in the place of substantial; as, for example, we may say that fire is a simple, hot, and dry body: for proper accidents are the effects of substantial forms, and make them known. Likewise, terms expressive of intention can be used in defining realities if used to signify things which are unnamed. And so the term "individual" is placed in the definition of person to signify the mode of subsistence which belongs to particular substances.
I don't think he says this in the Metaphysics, but he does say (De Anima iii, 7) that "the soul understands nothing without a phantasm." Thomas famously discusses this in Summa I q. 84 a. 6.
A 'phantasm' is broadly what 20th century philosophers used to call a 'sense datum', i.e. data directly present to sense which capture the accidental attributes of a substance.