1

我试图从下面页面中的站立表中获取团队名称和href链接,但其源代码没有显示团队名称列表等。请告诉我如何获取它?

http://arsiv.mackolik.com/Standings/Default.aspx?sId=57488

4

1 回答 1

2

您可以在下面进行 API 调用并获得排名数据

import requests

headers = {
    "accept": "application/json, text/javascript, */*; q=0.01",
    "accept-language": "en-US,en;q=0.9,el;q=0.8,he;q=0.7,de;q=0.6,fr;q=0.5,it;q=0.4,es;q=0.3",
    "cache-control": "no-cache",
    "pragma": "no-cache",
    "x-requested-with": "XMLHttpRequest",
    "Referer": "http://arsiv.mackolik.com/Standings/Default.aspx?sId=57488"
}
r = requests.get('http://arsiv.mackolik.com/AjaxHandlers/StandingHandler.ashx?op=standing&id=57488', headers=headers)
if r.status_code == 200:
    print(r.json())
else:
    print(r.status_code)

输出

{'id': 57488, 's': [[119, 'Bayern München', 17, 17, 13, 11, 4, 2, 0, 4, 64, 35, 21, 23, 43, 35, 0, 0, '', ''], [911, 'RB Leipzig', 17, 17, 11, 8, 4, 4, 2, 5, 29, 31, 13, 19, 37, 28, 0, 0, '', ''], [120, 'Borussia Dortmund', 17, 17, 11, 9, 2, 2, 4, 6, 40, 35, 20, 26, 35, 29, 0, 0, '', ''], [124, 'Wolfsburg', 17, 17, 10, 7, 4, 6, 3, 4, 32, 29, 16, 21, 34, 27, 0, 0, '', ''], [141, 'Eintracht Frankfurt', 17, 17, 10, 6, 7, 5, 0, 6, 37, 32, 20, 33, 37, 23, 0, 0, '', ''], [133, 'Bayer Leverkusen', 17, 17, 8, 6, 5, 5, 4, 6, 34, 19, 22, 17, 29, 23, 0, 0, '', ''], [146, 'Union Berlin', 17, 17, 8, 4, 8, 6, 1, 7, 32, 18, 18, 25, 32, 18, 0, 0, '', ''], [126, 'Mönchengladbach', 17, 17, 8, 5, 4, 6, 5, 6, 32, 32, 19, 37, 28, 21, 0, 0, '', ''], [129, 'Stuttgart', 17, 17, 5, 7, 6, 3, 6, 7, 27, 29, 26, 29, 21, 24, 0, 0, '', ''], [137, 'Freiburg', 17, 17, 7, 5, 6, 3, 4, 9, 33, 19, 23, 29, 27, 18, 0, 0, '', ''], [918, 'Hoffenheim', 17, 17, 8, 3, 3, 7, 6, 7, 32, 20, 24, 30, 27, 16, 0, 0, '', ''], [143, 'Mainz 05', 17, 17, 4, 6, 4, 5, 9, 6, 16, 23, 26, 30, 16, 23, 0, 0, '', ''], [916, 'Augsburg', 17, 17, 6, 4, 4, 2, 7, 11, 21, 15, 25, 29, 22, 14, 0, 0, '', ''], [125, 'Hertha Berlin', 17, 17, 5, 3, 5, 6, 7, 8, 21, 20, 26, 26, 20, 15, 0, 0, '', ''], [130, 'Arminia Bielefeld', 17, 17, 6, 3, 2, 6, 9, 8, 13, 13, 23, 29, 20, 15, 0, 0, '', ''], [138, 'Köln', 17, 17, 3, 5, 5, 4, 9, 8, 20, 14, 31, 29, 14, 19, 0, 0, '', ''], [121, 'Werder Bremen', 17, 17, 3, 4, 5, 5, 9, 8, 16, 20, 28, 29, 14, 17, 0, 0, '', ''], [122, 'Schalke 04', 17, 17, 3, 0, 3, 4, 11, 13, 14, 11, 34, 52, 12, 4, 0, 0, '', '']], 'f': [], 'r': [[3445271, '22/05', 'MS', 119, 916, '454136', 5, 2, '4 - 0', 4, 1.08, 6.75, 9, 0, 0, 3.3, 4.25, 1.06, 0, 0, 0, 1, 1.22, 4.25, 3.3, 0], [3445274, '22/05', 'MS', 124, 143, '454141', 2, 3, '0 - 1', 4, 1.67, 3.3, 3.25, 1.15, 1.15, 1.6, 2.5, 1.28, 0, 0, 0, 1, 2.4, 3.5, 1.6, 0], [3445272, '22/05', 'MS', 120, 133, '454143', 3, 1, '1 - 0', 4, 1.42, 4, 3.9, 1.1, 1.1, 1.9, 3.1, 1.15, 0, 0, 0, 1, 1.9, 3.5, 1.9, 0], [3445278, '22/05', 'MS', 121, 126, '454138', 2, 4, '0 - 1', 4, 2.75, 3.1, 1.9, 1.48, 1.15, 1.22, 2.25, 1.35, 0, 0, 1, 0, 1.48, 3.5, 2.85, 0], [3445276, '22/05', 'MS', 146, 911, '454139', 2, 1, '0 - 0', 4, 3.1, 3.2, 1.75, 1.55, 1.15, 1.18, 2.05, 1.45, 0, 0, 1, 0, 1.55, 3.25, 2.65, 0], [3445273, '22/05', 'MS', 918, 125, '454140', 2, 1, '0 - 1', 4, 1.52, 3.5, 3.6, 1.12, 1.12, 1.75, 2.55, 1.25, 0, 0, 0, 1, 2.15, 3.4, 1.75, 0], [3445275, '22/05', 'MS', 141, 137, '454142', 3, 1, '0 - 0', 4, 1.85, 3.4, 2.6, 1.25, 1.15, 1.48, 3, 1.18, 0, 0, 0, 1, 2.65, 3.75, 1.48, 0], [3445279, '22/05', 'MS', 129, 130, '454137', 0, 2, '0 - 0', 4, 2.05, 3.1, 2.5, 1.25, 1.18, 1.4, 2.2, 1.38, 0, 0, 0, 1, 3.2, 3.6, 1.4, 0], [3445277, '22/05', 'MS', 138, 122, '454135', 1, 0, '0 - 0', 4, 1.28, 4.4, 5.25, 1.06, 1.08, 2.2, 2.9, 1.2, 0, 0, 0, 1, 1.65, 3.4, 2.2, 0]], 'd': [[1, 'Şampiyonlar Ligi', 1, 4, '1E365A'], [3, 'Avrupa Ligi', 5, 2, '2270FF'], [60, 'Konferans Ligi Elemeler', 7, 1, '00CCFF'], [13, 'Play Out', 16, 1, 'FA8181'], [6, 'Alt Lig', 17, 2, 'F03B3B']]}
于 2021-09-26T20:23:57.933 回答