I am trying to get a list of the domains from the first 100 results:
For example: abc.com/xxxx/dddd the domain should be: abc.com
I am using this following code:
import time
from bs4 import BeautifulSoup
import requests
search=input("What do you want to ask: ")
search=search.replace(" ","+")
link="https://www.google.com/search?q="+search
print(link)
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
source=requests.get(link, headers=headers).text
soup=BeautifulSoup(source,"html.parser")
soup=BeautifulSoup(source,"html.parser")
However, I don`t know how to select only the domains, nor how to specify 100 results.
When I write the soup.text
I only get:
'te - Pesquisa Google(function(){window.google={kEI:\'jsCaXM3AHM6g5OUP4eyT2A0\',kEXPI:\'31\',authuser:0,kscs:\'c9c918f0_jsCaXM3AHM6g5OUP4eyT2A0\',kGL:\'BR\'};google.sn=\'web\';google.kHL=\'pt-BR\';})();(function(){google.lc=[];google.li=0;google.getEI=function(a){for(var b;a&&(!a.getAttribute||!(b=a.getAttribute("eid")));)a=a.parentNode;return b||google.kEI};google.getLEI=function(a){for(var b=null;a&&(!a.getAttribute||!(b=a.getAttribute("leid")));)a=a.parentNode;return b};google.https=function(){return"https:"==window.location.protocol};google.ml=function(){return null};google.time=function()