Skip to main content

A Python package collect data from Quora.

Project description

quoras

A Python package to collect data from Quora.

Installation

The package is available on PyPI. Simply run the following command:

pip install quoras

Setup

Create a folder called chrome_path in the same directory as your source file. Download the ChromeDriver from here and place the chromedriver.exe file in the newly created folder.

Initialize

You need to have account on Quora (or its language-specific forum) to collect data from it. Initialize the Quora class as following providing your credentials and language code. The language codes can be found here.

quora = Quora ('email-address', 'password', 'language-code')

Usage

This package allows you to call several functions. Search with keywords for questions, topics or users with function search(keyword, type='post', scroll_count=1). Change type to 'topic' or 'user' to search topic RSS pages or user profiles respectively. You can pass a value for scroll_count to control how many scrolls the web browser will automatically do.

posts = quora.search('ancient history', 'post', scroll_count=1)
topics = quora.search('finance', 'topic', scroll_count=1)
users = quora.search('Dipto Das', 'user', scroll_count=1)

There are alternative ways to search posts or users. You can call search_posts(keyword, scroll_count=1) function that searches for posts with specified keyword without requiring explicitly indicating type. Similarly, search_users(keyword, scroll_count=1) function to search users containing keyword in their profile names. You can also pass a value for scroll_count to control how many scrolls the web browser will automatically do.

questions = quora.search_posts('ancient history', scroll_count=1)
users = quora.search_users('Dipto Das', scroll_count=1)

To search for Q/A threads with a specific user-assigned topic tag, you can simply call search_topic(topic, scroll_count=1) function as follows:

topic_questions = search_topic('politics', scroll_count=5)

If you already have an url, you can directly search details about that entry. If it is an url to a Q/A thread, then it will return the question, topics, answers, participating users, and Quora suggested related questions. If it is an url to a user profile, then it will return statistics about the user (e.g., number of public answers, number of questions, number of shares, number of posts, number of followings, and number of followers), and links to top (defined by Quora) posts from the user. To use this function, you have to call search_url(url) function.

qathread_details = quora.search_url('https://bn.quora.com/আসামকে-কেন-সবাই-অসম-বলছে')
user_details = quora.search_url('https://www.quora.com/profile/Dipto-Das-1')

Importantly, quoras can can retrieve the full text in an answer given its url. For that, you need to call get_full_answer(url) function as following:

full_answer = quora.get_full_answer('https://bn.quora.com/বিজ্ঞানীদের-মধ্যেও-কি/answers/150612153')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quoras-1.1.1.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quoras-1.1.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file quoras-1.1.1.tar.gz.

File metadata

  • Download URL: quoras-1.1.1.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for quoras-1.1.1.tar.gz
Algorithm Hash digest
SHA256 2a271f0351e6ce549b0846d809b0a90f6de8edbfb7dd04f39fecca88b9d03eb5
MD5 eaff1b11a43ab171cbc862c27ed9e41e
BLAKE2b-256 cad0a9050edb7075d8d87dce8d2d88d1de5ea51439cd9054b78ec346993b8153

See more details on using hashes here.

File details

Details for the file quoras-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: quoras-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for quoras-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 eacc259154f7b0157816dc596615fe57caa76a2a70c1c1f3e9e35a6845d1a971
MD5 14e17e1b568b250c954f0b36953b41d8
BLAKE2b-256 abfd41598a3c76f2bb9c224c42a96fafc15aee012eb5ecd927fabd751e7e4c0e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page