Crawler problem, keep getting the error: " TypeError: 'NoneType' object is not callable"

+1 Mas Airman · February 3, 2016
I know this will turn out to be a stupid simple thing but I began learning Python a week ago, so bear with me here:

import requests
from bs4 import BeautifulSoup

def ishcrw(wtif):
  pages = 1
  while pages <= wtif:
  url = 'http://insidehoops.com/forum/showthread.php?t=396994&page=' + str(pages)
  source = requests.get(url)
  txt = source.text
  soup4 = BeautifulSoup(txt, 'html.parser')
  for ids in soup4.findALL('a', {'class': 'bigusername'}):
      href = 'http://insidehoops.com/forum/' + ids.get('href')
      title = ids.string
      print(href)
      print(title)
  pages =+ 1

ishcrw(1)

I'm trying to grab the usernames and their corresponding links on a sample thread in that forum.

Post a Reply

Replies

Oldest  Newest  Rating
0 Mas Airman · February 3, 2016
Btw, this is an excerpt from the page source:

<div id="postmenu_12094678">



<a class="bigusername" href="member.php?u=10283">Lebron23</a>

<script type="text/javascript"> vbmenu_register("postmenu_12094678", true); </script>



</div>
0 Taiwo Kareem · February 4, 2016
You haven't returned anything from the method. That is why. you need return as the last line of your method.
+1 sfolje 0 · February 4, 2016
Second answer:

typo aka typing error aka tiny lil mistake

Take a look :

    findAll vs. findALL

Notice any difference?
You got it.
0 Mas Airman · February 5, 2016
@sfolje LMAO thanks man, I knew it was something silly and trivial like that, you saved my life :P
+1 sfolje 0 · February 5, 2016
no problem, brah
  • 1

Python

107,161 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator