I would personally just use CSS selectors to target the div element with the player-details class and anchor tags under it. After that, just access the href attribute and use a regular expression to extract the number:
from bs4 import BeautifulSoup
import re
HTML = """
<div class="player-details">
<a href="https://www.baseballamerica.com/players/102352/gunnar-henderson/" title="Gunnar Henderson">Gunnar Henderson</a>
</div>
"""
RE_NUM = re.compile(r'/(\d{6})/')
soup = BeautifulSoup(HTML, 'html.parser')
for a in soup.select('div.player-details a'):
print(RE_NUM.search(a['href']).group(1))