Python Forum

Full Version: Code stops after 20min+ with no output
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

I'm trying to get the 'src' from 500 profile pictures on Transfermarkt. I've managed to get the URL:s for every player in a list, but when I'm iterating through them to get the 'src' for their profile picture, the code just goes on and on, for 20min+ and then stops, without any output.

List of players

Please help.

from bs4 import BeautifulSoup
import requests
import pandas as pd

playerID = []
playerImgSrc = []

result = []

for page in range(1, 21):

    r = requests.get("",
        params= {"page": page},
        headers= {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0"}
    soup = BeautifulSoup(r.content, "html.parser")

    links ='a.spielprofil_tooltip')
    for i in range(len(links)):

    playerProfile = ["" + x for x in playerID]

    for p in playerProfile:
        html = requests.get(p).text
        soup = BeautifulSoup(html, "html.parser")
        link ='div.dataBild')

    for i in range(len(link)):
line 33:
for i in range(len(link)):
shouldn't this be:
for i in range(len(links)):

or if not, lines 33-34 need to be indented