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 returned #4

Closed gneusch closed 3 years ago

gneusch commented 3 years ago

Hi Josh, I've read your update on the readme. I tried to use: user_agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0' in the header and changed the id for the div: soup.find('div', {'id': 'result-stats'}) and I got back results.

I didn't integrated this however into your code, but used your code and modified https://github.com/MarioVilas/googlesearch - here is the commit https://github.com/gneusch/googlesearch/commit/a71bc517014eab65c9c9948aba5c815f796dbff5

So I'm not sure how could you use this user agent string with fake_useragent. Best regards, Lóri

josh-ashkinaze commented 3 years ago

Hi,

I messed around with this and the fix was soup.find('div', {'id': 'result-stats'}) so I just updated the master branch with that. I did not need to change any user agent stuff.

Thanks a lot for your contribution!