Skip to main content

People-also-ask Api

Code style: black PyPI versions

People-also-ask provides APIs to easily crawl the data of google featured snippet.

⚠ Warning

Search engines like Google do not allow any sort of automated access to their service but from a legal point of view there is no known case or broken law. Google does not take legal action against scraping, likely for self-protective reasons. API have been configured to not abuse google search engine.

Installation

pip install people_also_ask 

Usage

Goal of people_also_ask is to provide simple and easy to use API for retrieving informations from Google Featured Snippet.

Importing

import people_also_ask

How to get related questions

people_also_ask.get_related_questions("coffee")

['Is coffee good for your health?',
 	'Why is coffee bad for you?',
 	'Who invented coffee?',
	'What do u know about coffee?']

How to get more questions

people_also_ask.get_related_questions("coffee", 5)

['How did coffee originate?',
	'Is coffee good for your health?',
  'Who brought coffee America?',
	'Who invented coffee?',
	'Why is coffee bad for you?',
	'Why is drinking coffee bad for you?']

Generate unlimited questions

for question in people_also_ask.generate_related_questions("cofee")

Why is coffee bad for you?
Who invented coffee?
Is coffee good for your health?
Who brought coffee America?
How did coffee originate?
Why is drinking coffee bad for you?
....

Get answer for a question

people_also_ask.get_answer("Why is coffee bad for you?")

{'has_answer': True,
 'question': 'Why is coffee bad for you?',
 'related_questions': ['Why is drinking coffee bad for you?',
  'Is coffee good for your health?',
  'Is coffee toxic to your body?',
  'What does coffee do to your body?'],
 'response': 'Consuming too much caffeine can lead to jitteriness, anxiety, heart palpitations and even exacerbated panic attacks (34). If you are sensitive to caffeine and tend to become overstimulated, you may want to avoid coffee altogether. Another unwanted side effect is that it can disrupt sleep ( 35 ).Aug 30, 2018',
 'heading': 'Consuming too much caffeine can lead to jitteriness, anxiety, heart palpitations and even exacerbated panic attacks (34). If you are sensitive to caffeine and tend to become overstimulated, you may want to avoid coffee altogether. Another unwanted side effect is that it can disrupt sleep ( 35 ).Aug 30, 2018',
 'title': 'Coffee — Good or Bad? - Healthline',
 'link': 'https://www.healthline.com/nutrition/coffee-good-or-bad#:~:text=Consuming%20too%20much%20caffeine%20can,can%20disrupt%20sleep%20(%2035%20).',
 'displayed_link': 'www.healthline.com › nutrition › coffee-good-or-bad',
 'snippet_str': 'Consuming too much caffeine can lead to jitteriness, anxiety, heart palpitations and even exacerbated panic attacks (34). If you are sensitive to caffeine and tend to become overstimulated, you may want to avoid coffee altogether. Another unwanted side effect is that it can disrupt sleep ( 35 ).Aug 30, 2018\nwww.healthline.com › nutrition › coffee-good-or-bad\nhttps://www.healthline.com/nutrition/coffee-good-or-bad#:~:text=Consuming%20too%20much%20caffeine%20can,can%20disrupt%20sleep%20(%2035%20).\nCoffee — Good or Bad? - Healthline',
 'snippet_data': None,
 'date': None,
 'snippet_type': 'Definition Featured Snippet',
 'snippet_str_body': '',
 'raw_text': 'Featured snippet from the web\nConsuming too much caffeine can lead to jitteriness, anxiety, heart palpitations and even exacerbated panic attacks (34). If \nyou\n are sensitive to caffeine and tend to become overstimulated, \n may want to avoid \ncoffee\n altogether. Another unwanted side effect is that it can disrupt sleep ( 35 ).\nAug 30, 2018\nCoffee — Good or Bad? - Healthline\nwww.healthline.com\n › nutrition › coffee-good-or-bad'}

Get Simple Answer for a question

people_also_ask.get_simple_answer("Why is coffee bad for you?")

'Consuming too much caffeine can lead to jitteriness, anxiety, heart palpitations and even exacerbated panic attacks (34). If you are sensitive to caffeine and tend to become overstimulated, you may want to avoid coffee altogether. Another unwanted side effect is that it can disrupt sleep ( 35 ).Aug 30, 2018'

Generate questions and answers relative to a subject

people_also_ask.generate_answer("coffee")

Using proxies

import people_also_ask.request.session

people_also_ask.request.session.set_proxies(
    (
        "http://1234.5.6.7:8080",
        "http://1237.5.6.7:8080",
    )
)

Release files for people-also-ask 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for people-also-ask 1.1.0
File Size Uploaded
people_also_ask-1.1.0.tar.gz 12.5 kB Details

Release files / people_also_ask-1.1.0.tar.gz

Download URL people_also_ask-1.1.0.tar.gz
Size 12.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6f54b5844645e3f76a9b45ee2ca7ff100e6e22bb22646f3447d2b173b30bcd1b
BLAKE2b-256 checksum
How to use checksums
da74a74192775ebe441b6e217d3daf9ce5ba8475985cbba8dc73ed80b19507d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.8.2 requests/2.25.1 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.5.3

Release history Release notifications | RSS feed

This release

1.1.0 This release

1 release file

1.0.0

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page