DEV Community

Fillip Kosorukov
Fillip Kosorukov

Posted on

Automating Quora Answers With Python, GraphQL, and a Task Queue

Automating Quora Answers With Python, GraphQL, and a Task Queue

I needed a repeatable way to post helpful answers on Quora without spending hours browsing questions manually. Here's the system I built — runs on a $6/month VPS, end to end.

Problem

Quora is great for organic traffic, but the workflow is manual and time-consuming: browse questions, evaluate which ones are worth answering, write something useful, post it, repeat. As a solo founder running four products, I don't have time for that daily.

Solution: A Five-Stage Pipeline

Stage 1: Question Discovery

find_quora_questions.py hits the Serper API (a Google search API) with queries like:

site:quora.com "how to" AI visibility local business
site:quora.com online reputation management
site:quora.com solo founder startup
Enter fullscreen mode Exit fullscreen mode

Each result gets scored by:

  • Recency — newer questions get more weight
  • Answer count — fewer existing answers = more visibility
  • Relevance — keyword matching against topic pillars
  • Already posted — checked against quora_posted.json

Output: a ranked JSON list of question URLs.

Stage 2: Answer Drafting

An AI agent picks the top 3 questions and writes standalone answers. The constraint is quality — Quora's algorithm surfaces genuinely helpful answers, so the drafts need to provide real value, not just keyword-stuffed backlink attempts.

Each answer is saved as a markdown file.

Stage 3: Task Queue

Instead of posting directly, the agent runs queue_post.sh which writes a .json file per answer to ~/seo-publisher/queue/. Each task file contains:

{
  "url": "https://www.quora.com/How-do-you-get-your-business-featured-in-AI-search-results",
  "body_file": "articles/quora-new-2026-04-04-1.md"
}
Enter fullscreen mode Exit fullscreen mode

This decouples "deciding what to post" from "actually posting." The agent never touches Quora's API directly.

Stage 4: Background Watcher

queue_watcher.sh runs as a background process, polling the queue directory every 30 seconds. When it finds task files, it executes publish_quora.py --api-only for each one.

Success → task moves to done/, URL added to quora_posted.json
Failure → task moves to failed/ (no infinite retries)

Stage 5: GraphQL API Posting

This is the interesting part. My first approach used Playwright with a headless browser. Cloudflare's Turnstile killed it.

The working approach uses curl_cffi — a Python library that impersonates real browser TLS fingerprints. The flow:

# Simplified version of the core logic
from curl_cffi import requests

session = requests.Session(impersonate="chrome131")
session.cookies.update(load_cookies("quora_state.json"))

# Fetch question page to extract form key + question ID
page = session.get(question_url)
formkey = extract_formkey(page.text)
qid = extract_qid(page.text)

# Convert markdown to Quora's internal format
sections = markdown_to_quora_sections(answer_body)

# Post via GraphQL
response = session.post("https://www.quora.com/graphql/gql-para-POST",
    json={
        "queryName": "AnswerEditorMutation_answerCreate_Mutation",
        "variables": {
            "input": {
                "questionId": qid,
                "content": json.dumps({"sections": sections}),
            }
        },
        "extensions": {"hash": mutation_hash}
    },
    headers={"quora-formkey": formkey}
)
Enter fullscreen mode Exit fullscreen mode

Key details:

  • TLS fingerprinting via curl_cffi bypasses Cloudflare without running a browser
  • The mutation hash changes when Quora deploys. The script auto-discovers new hashes by parsing the page's webpack bundles
  • Markdown to Quora format conversion handles bold, paragraphs, and inline formatting
  • Browser-based fallback is preserved via --browser-only flag

Results

  • 5 answers posted in one session
  • Zero Cloudflare blocks via the API path
  • Pipeline triggers with a single command
  • Runs alongside 4 other products on the same VPS

Takeaways for Developers

  1. Skip the browser when you can. If the platform has a GraphQL or REST API under the hood, call it directly. Browser automation is a maintenance burden.

  2. curl_cffi > requests for Cloudflare sites. Standard Python requests gets flagged immediately. curl_cffi with impersonate="chrome131" passes TLS fingerprint checks.

  3. Task queues solve policy problems. Some AI models refuse to interact with third-party services. Having them write to a local queue instead keeps the pipeline working regardless of model constraints.

  4. Track state. A simple JSON file of posted URLs prevents duplicate answers and wasted API calls.

Stack

Component Tool
Question discovery Python + Serper API
Answer drafting AI agent
Queue management Bash scripts
API posting curl_cffi + Quora GraphQL
State tracking quora_posted.json
Infrastructure Vultr VPS, Ubuntu 24, $6/mo

Total: ~400 lines of Python, ~50 lines of shell.


I'm Fillip Kosorukov. I build LocalMention, SetupLens, FixMyRecord, and Resilience — all on one server. I write about solo founding, automation, and AI visibility.

Top comments (0)