I am beginner in data scraping. In this case, I want to get a URL like "https:// . . .", but the result is a list in a link variable that contains of all links on the web. Here is the code below; import requests from bs4 import BeautifulSoup url = 'https://www.detik.com/search/searchall?query=KPK' page = requests.get(url) soup = BeautifulSoup(page.content, 'html.parser') artikel = soup.findAll('div', {'class' : 'list media_rows list-berita'}) p = 1 link = [] for p in artikel: s = p.findAll('a', href=True)['href'] link.append(s) The result of the code above is getting an error such as: TypeError Traceback (most recent call last) <ipython-input-141-469cb6eabf70> in <module> 3 link = [] 4 for p in artikel: 5 s = p.findAll('a', href=True)['href'] 6 link.append(s) TypeError: list indices must be integers or slices, not str The result is I want to get all links of https:// . . . in <div class = 'list media_rows list-berita' as a list Continue reading...