  Characterising the atmospheres of exoplanets is key to understanding their
nature and provides hints about their formation and evolution. High-resolution
measurements of the helium triplet, He(2$^{3}$S), absorption of highly
irradiated planets have been recently reported, which provide a new mean to
study their atmospheric escape. In this work, we study the escape of the upper
atmospheres of HD 189733 b and GJ 3470 b by analysing high-resolution
He(2$^{3}$S) absorption measurements and using a 1D hydrodynamic model coupled
with a non-LTE model for the He(2$^{3}$S) state. We also use the H density
derived from Ly$\alpha$ observations to further constrain their temperatures,
T, mass-loss rates,$\dot M$, and H/He ratios. We have significantly improved
our knowledge of the upper atmospheres of these planets. While HD 189733 b has
a rather compressed atmosphere and small gas radial velocities, GJ 3470 b, with
a gravitational potential ten times smaller, exhibits a very extended
atmosphere and large radial outflow velocities. Hence, although GJ 3470 b is
much less irradiated in the XUV, and its upper atmosphere is much cooler, it
evaporates at a comparable rate. In particular, we find that the upper
atmosphere of HD 189733 b is compact and hot, with a maximum T of
12400$^{+400}_{-300}$ K, with very low mean molecular mass
(H/He=(99.2/0.8)$\pm0.1$), almost fully ionised above 1.1 R$_p$, and with $\dot
M$=(1.1$\pm0.1$)$\times$10$^{11}$ g/s. In contrast, the upper atmosphere of GJ
3470 b is highly extended and relatively cold, with a maximum T of 5100$\pm900$
K, also with very low mean molecular mass (H/He=(98.5/1.5)$^{+1.0}_{-1.5}$),
not strongly ionised and with $\dot M$=(1.9$\pm1.1$)$\times$10$^{11}$ g/s.
Furthermore, our results suggest that the upper atmospheres of giant planets
undergoing hydrodynamic escape tend to have very low mean molecular mass
(H/He$\gtrsim$97/3).
