balzer82 / immoscraper

Immoscout24.de scraper and data analytics
48 stars 24 forks source link

'NoneType' object is not subscriptable #3

Closed Freelix123 closed 4 years ago

Freelix123 commented 4 years ago

I just got started with Python as I was interessted in Immo data and wanted to produce my own scrapes. I found your instruction very helpful. My Scraper was running perfectly fine for a month. Thank you! But since the beginning of June I get the following error:

'NoneType' object is not subscriptable

The problems stems from looping through the scripts list and finding the script with the term 'IS24.resultList'

Line 60: soup = BeautifulSoup(urlquery(url), 'html.parser') scripts = soup.findAll('script') for script in scripts:

print script.text.strip()

        if 'IS24.resultList' in script.text.strip():
            s = script.string.split('\n')

the script.text.strip() command does no longer output any text. I have tried many variations, but don t get it to work. I am currently going through the bs4 documentation to seek alternatives. For me the problem came up after a spyder update. Though, I don t know whether this stands in any relation with the appearence of the problem. Maybe you can help?

balzer82 commented 4 years ago

Tested it, works just fine. Check the url the script is using, if you typed everything right.

Maybe check the versions you are using, e.g. BeautifulSoup?!

$ pip freeze|grep "beautifulsoup4"
beautifulsoup4==4.6.3
Freelix123 commented 4 years ago

Sorry for the confusion. I have deinstalled and reinstalled Anconda. It runs perfectly fine again...

balzer82 commented 4 years ago

What was the problem? Beautifulsoup version issue or another problem?

raouldke commented 4 years ago

Yes, it was Beautifulsoup, the latest Version(4.9.1) has apparently an issue, that text property is always null

Freelix123 commented 4 years ago

Thanks, raouldke! I hadn't had the time to look this up, but this explenation fits 100% to my issue!