Problem with web crawling? Tut 25

+1 Arthur North · February 23, 2015
Beginner here. I keep getting "Process finished with exit code 0" everytime I run the code. I even copy/pasted Bucky's code (from here: and still don't get any output, so I'm guessing this isn't a problem with the code? 

The indentation doesn't appear to work properly below. Please ignore that.

import requests
from bs4 import BeautifulSoup

def game_spider(max_pages):
page = 1
while page <= max_pages:
url = "" + str(page)
source_code = requests.get(url)
plain_text = source_code.text
soup = BeautifulSoup(plain_text)
for link in soup.findAll('a', {'class': 'won'}'):
 href = "" + link.get('href')
 title = link.string # just the text, not the HTML
page += 1


Post a Reply


Oldest  Newest  Rating
0 Yoncho Yonchev · February 25, 2015
Use print (<something_i_wanna_check>) to debug. It is quite useful to learn how to debug your own code.
0 Seamus Narron · February 25, 2015
You have an extra single quote in the soup.findAll call. Should be:

for link in soup.findAll('a', {'class': 'won'}):
  • 1



This section is all about snakes! Just kidding.

Bucky Roberts Administrator