Created
September 11, 2019 10:10
-
-
Save joereddington/718f6583181cc2092de70d2008f014b6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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