Spellsteal

3rd-level Abjuration
Casting Time: 1 reaction, when a spell ends in range
Range: 120 feet
Components: VS
Duration: Instantaneous

You may attempt to steal magical effects that dissipate from nearby creatures for yourself. When a spell ends involuntarily, such as by being dispelled or by a creature losing concentration, you may attempt to steal that magical effect for yourself. If the spell is 2nd level or lower, you steal the effects of it automatically. If the spell is 3rd level or higher, make an ability check using your spellcasting ability. The DC equals 10 + the spell's level. On a successful check, you gain the effects of this spell.
The spell's duration is equal to the remaining duration of the spell when it was dispelled, to a maximum of 1 minute. If the spell is a concentration spell, concentration is transferred to you; if you are already concentrating on a spell, you lose concentration on that spell in favor of the spell you stole. You may cast spellsteal on a turn in which you already casted a spell of first level or higher, but only if that spell dispels a magic effect.
At Higher Levels. When you cast this spell using a spell slot of 4th level or higher, you automatically steal the effects of a spell on the target if the spell's level is less than the level of the spell slot you used.

Source: Homebrew