Skip to content

Instantly share code, notes, and snippets.

@joereddington
Created September 11, 2019 10:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joereddington/718f6583181cc2092de70d2008f014b6 to your computer and use it in GitHub Desktop.
Save joereddington/718f6583181cc2092de70d2008f014b6 to your computer and use it in GitHub Desktop.
import requests
from bs4 import BeautifulSoup
import argparse
def check(word):
gr = requests.get('http://www.google.com/search', params={'q':'"'"she was "+word+'"', "tbs":"li:1"})
br = requests.get('http://www.google.com/search', params={'q':'"'"he was "+word+'"', "tbs":"li:1"})
girlsoup = BeautifulSoup(gr.text, "lxml")
girltext= girlsoup.find('div',{'id':'resultStats'}).text[6:-8]
boysoup = BeautifulSoup(br.text, "lxml")
boytext= boysoup.find('div',{'id':'resultStats'}).text[6:-8]
print "{}: M: {} F: {}".format(word, boytext,girltext)
check("brave")
check("pretty")
check("curious")
check("strong")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment