In Li et al.'s work on optimal probabilistic teleportation in the two-level case [W. L. Li, C. F. Li, and G. C. Guo, Phys. Rev. A 61, 034301(2000)], the authors consider the extraction of the unknown qubit $|\ensuremath{\varphi}〉={\ensuremath{\alpha}}_{0}|0〉+{\ensuremath{\alpha}}_{1}|1〉$ from the qubit $|\ensuremath{\psi}〉=(1/\sqrt{N})({\ensuremath{\alpha}}_{0}{\ensuremath{\beta}}_{0}|0〉+{\ensuremath{\alpha}}_{1}{\ensuremath{\beta}}_{1}|1〉).$ In this paper, we consider the extraction in the n-level case. It is proved that, under some specific collective unitary transformation U on $|\ensuremath{\psi}〉$ and auxiliary qubits as probe, the maximal probability of successfully extracting the wanted qubit is $(1/N)\mathrm{min}{{\ensuremath{\beta}}_{i}^{2}}.$ It is also shown that the entries of such U are independent of all unknown ${\ensuremath{\alpha}}_{i}.$ The result can also be used in the purification of the entanglement via entanglement swapping.