Python Forum

Full Version: Wrong number of google results in a date range
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I have been trying to scrape the number of results within a certain date range on google. I have done this by inserting the date into the google search query. However, the code I wrote is getting the wrong number of results, probably out of the date range or in a different domain/country. My code is the following:

query='Kevin Spacey prima: 14/1/2020 dopo 14/1/2020'

for url in search(
            query, 
            tld='it',
            lang='it',
            num=20,
            start=0,
            stop=None,
            pause=2.0
      ):
            try: 
                r = requests.get(url, timeout=None)
                r.headers
                r.status_code
                urls.append(url)              
            except: 
                pass
I am using the module search from googlesearch library. I would be interested in google.it and in Italian pages (both language and country). I am looking for results about Kevin Spacey in the range January 14th 2020 and January 14th 2020 (same day).
From Google search I am getting 13 results; using my code 39. The problem is that 'my' results do not match with those ones from google. I think the problem is in the query, specifically in the date range, but I am not completely sure how to fix it. I hope you can tell me what I am doing wrong.

Please see below the URL for google results:

https://www.google.co.uk/search?q=Kevin%...wN6BAgEEC4

It is include also the date range as:

cdr:1,cd_min:1/14/2020,cd_max:1/14/2020
but I do not know how to include it in my code.
I tried to edit search as follows:

search(
            query, 
            tld='it',
            lang='it',
            num=20,
            start=0,
            stop=None,
            pause=2.0
            tbs='cdr:1,cd_min:1/14/2020,cd_max:1/14/2020'
      ):
with query='Kevin Spacey'(and not query=Kevin Spacey prima: 14/1/2020 dopo 14/1/2020'), but nothing has changed. Huh

This is the list of urls that I get when I run my code:

https://tv.zam.it/programmi_in_tv_stasera.php
https://www.paramountnetwork.it/video/v5ln5t/film-paramount-network-gli-highlights-per-la-settimana-del-2-marzo-2020
https://www.davidemaggio.it/archives/181396/programmi-tv-di-stasera-martedi-14-gennaio-2020-su-rai2-il-film-amore-cucina-e-curry-al-posto-de-il-molo-rosso-spostato-in-seconda-serata
https://www.davidemaggio.it/archives/181401/ascolti-tv-lunedi-13-gennaio-2020
https://www.mymovies.it/film/2016/elvisnixon/pubblico/?id=778281
https://www.ilfoglio.it/siteMapVideo.jsp
http://www.starpolitics.it/author/redazione/page/2/
http://www.zorrolaleggenda.rai.it/dl/RaiTV/programmi/media/ContentItem-4acbbd88-0529-4ca5-a390-96cb38dd2317.html
https://www.lagazzettadellospettacolo.it/cinema/26473-nicholas-hoult-giurati-giffoni-film-festival-2016/
https://www.viaggiareleggeri.com/cerca/x/i
https://www.lagazzettadellospettacolo.it/musica/30431-peter-cincotti-live-italia/
https://www.viaggiareleggeri.com/cerca/x/-?ref=28250
https://www.audible.it/pd/Harry-Potter-e-il-Prigioniero-di-Azkaban-Harry-Potter-3-Audiolibri/B077HVX4WM
https://www.hfw.com/Briefings
http://www.inmediarex.it/cinema-tv/cinema-tv-recensioni/american-gods-la-serie-niente-di-cosi-divino/
http://america24.com/sitemapArticles.xml
https://www.weenjoy.net/sitemap/
https://ierioggidomaniblog.com/2017/06/02/e-arrivata-la-promo-shock-universal-su-amazon-tante-offerte-fino-al-2-luglio/
https://ierioggidomaniblog.com/2018/01/13/universal-pictures-baby-driver-barry-seal-linganno-e-madre/
https://www.glartent.com/IT/Rome/112229858801846/giovani-artisti-associati-srl
https://tubestar.it/breakingitaly
https://www.freeforumzone.com/d/1543749/Oggi-ho-visto-in-TV/discussione.aspx/18
https://mjj.freeforumzone.com/discussione.aspx?idd=662389
https://www.diariodelweb.it/tuttosu/tag/?q=4750
https://civiltascomparse.wordpress.com/category/p-greco/?ak_action=reject_mobile
https://www.ubook.com/audiobook/348309/copy-persuasivo-di-andrea-lisi
https://ipersphera.org/category/attrice/
https://www.luogocomune.net/28-opinione/4827-svezia-laboratorio-per-il-nwo
https://www.globalnpo.org/IT/Salerno/1382814642039640/La-Bottega-Di-Will
https://www.qoop.it/osvaldo-raschi-pugile?page=1
https://www.qoop.it/pugile-al-cogan?filter=lastyear
http://www.caminantes.it/page-16/index.php?categories=giornalisti
https://www.altadefinizione01.tel/10495-terminator-destino-oscuro-stream-ita.html
https://www.emailers.it/codice-sconto-del-50-cibdol-10-promozione-limitata/
https://aimatrabolmeicher.com/2014/03/03/oscar-2014-and-the-winner-is/
https://aimatrabolmeicher.com/goodbye/page/2365/
http://scandalissimi.it/home-archive.php
https://picnano.com/tags/prossimieventi
https://vilook.com/video/9E0I69VkXFc/il-lento-declino-dellitalia-qual-%C3%A8-il-vero-problema-breakingitaly-news
Thank you for your time and for the help you will provide me.