josh-ashkinaze / Normalized-Google-Distance

A python script to calculate normalized google distance (NGD). This is a semantic similarity metric based on Google search results
15 stars 6 forks source link

'NoneType' object has no attribute 'text' #9

Open EdwinKuo1337 opened 3 years ago

EdwinKuo1337 commented 3 years ago

I saw there is a closed issue about this, however, I believe the problem happens again. when I search for: calculate_NGD('apple', 'juice') the result is:

Trying again...
'NoneType' object has no attribute 'text'
Trying again...
'NoneType' object has no attribute 'text'
EdwinKuo1337 commented 3 years ago

update: I have found the solution. Turns out the header needs to be update to be: headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36'}