Polymarket Scraper - Linux Guide ← Back to OS Selection

Polymarket Scraper

Linux Guide

Welcome Linux User!

This guide will walk you through installing and running the Polymarket Scraper on Linux. Since you're using Linux, you probably have some tech experience, but we'll keep this beginner-friendly.

Time needed: About 10-15 minutes

What You'll Need

  • A Linux system (Ubuntu, Debian, Fedora, Arch, etc.)
  • Internet connection
  • Terminal access
  • The polymarket1.py file (the code you were given)

Step 1: Install Python

Most Linux distributions come with Python pre-installed. Let's check if you have Python 3:

Check Python Version

Open your terminal (Ctrl+Alt+T on most distros) and run:

python3 --version

If you see something like Python 3.x.x, you're good to go! Skip to Step 2.

If Python 3 isn't installed, use your distribution's package manager:

Ubuntu / Debian / Linux Mint

sudo apt update sudo apt install python3 python3-pip

Fedora / RHEL / CentOS

sudo dnf install python3 python3-pip

Arch Linux / Manjaro

sudo pacman -S python python-pip

openSUSE

sudo zypper install python3 python3-pip
Success! Once installed, verify with python3 --version. You should see a version number like 3.x.x.

Step 2: Install Required Library

The script needs the requests library to fetch data from Polymarket's API.

Install via pip

pip3 install requests

Or if you prefer using your system package manager:

Ubuntu / Debian

sudo apt install python3-requests

Fedora

sudo dnf install python3-requests

Arch Linux

sudo pacman -S python-requests
Permission Issues? If you get permission errors with pip, either use sudo pip3 install requests or add --user flag: pip3 install --user requests
Success! The requests library is now installed!

Step 3: Save the Script File

Now let's save the Python code as a file.

Create a Directory

mkdir ~/PolymarketScraper cd ~/PolymarketScraper
Note: This creates a folder in your home directory. You can create it anywhere you prefer!

Save the Python Code

You have several options:

Option 1: Using a Text Editor (Recommended for Beginners)

  1. Open your favorite text editor (gedit, kate, nano, vim, etc.)
  2. Copy ALL of the polymarket1.py code
  3. Paste it into the editor
  4. Save as polymarket1.py in the PolymarketScraper folder

Option 2: Using nano (Terminal-based)

nano polymarket1.py

Paste the code, then press Ctrl + O to save and Ctrl + X to exit.

Option 3: Using vim

vim polymarket1.py

Press i for insert mode, paste the code, press Esc, type :wq and press Enter.

Quick Check: Verify the file was created: ls -l polymarket1.py

Step 4: Run the Script

Time to run the scraper!

Navigate to Your Directory

If you're not already there:

cd ~/PolymarketScraper

Run the Script

python3 polymarket1.py

The script will ask you three questions:

Question 1: Enter categories

Type the categories you want to search, separated by commas:

politics,crypto,tech

Available categories: politics, crypto, geopolitics, tech, world, trump, elections

Press Enter after typing.

Question 2: How many total markets to fetch?

Type a number (how many markets you want to see):

150

Press Enter.

Question 3: Minimum volume filter?

Type 0 to see all markets, or a number like 10000 to only see markets with at least $10,000 in volume:

0

Press Enter.

First Run? Try: politics,crypto, 50 markets, 0 minimum volume for a quick test!

The script will fetch data from Polymarket. You'll see progress messages. This takes 10-30 seconds.

Success! When you see "Successfully scraped X markets" and file creation messages, you're done!

Step 5: View Your Results

The script creates two files:

  • polymarket_feed.html - Beautiful results page
  • polymarket_data.json - Raw JSON data

Open the HTML File

You can open it several ways:

Method 1: Default Browser

xdg-open polymarket_feed.html

Method 2: Specific Browser

firefox polymarket_feed.html

Or use: chromium, google-chrome, brave, etc.

Method 3: File Manager

Navigate to ~/PolymarketScraper in your file manager and double-click polymarket_feed.html

Congratulations! You should see a beautifully formatted page with all the Polymarket markets, organized by category!

What You'll See

  • Markets sorted by category (Politics, Crypto, Tech, etc.)
  • For each market:
    • The prediction question
    • Trading volume and liquidity
    • Current odds (YES/NO percentages)
    • End date
    • Link to Polymarket.com

Running It Again

To update data or change search parameters:

cd ~/PolymarketScraper python3 polymarket1.py

Answer the prompts with your new preferences. Refresh your browser (F5 or Ctrl+R) to see updated results!

Automation Tip: Create a bash alias for quick access:
echo "alias polymarket='cd ~/PolymarketScraper && python3 polymarket1.py'" >> ~/.bashrc
Then just type polymarket to run it anytime!

Troubleshooting Common Issues

Problem: python3: command not found

Solution: Python 3 isn't installed. Install it using your package manager (see Step 1).

Problem: No module named 'requests'

Solution: Install the requests library:

pip3 install requests

Or use --user flag: pip3 install --user requests

Problem: Permission denied when installing

Solutions:

  • Use sudo: sudo pip3 install requests
  • Or install for user only: pip3 install --user requests

Problem: Error fetching markets

Solution:

  • Check your internet connection: ping google.com
  • Check if firewall is blocking Python
  • Polymarket API might be temporarily down - wait and retry

Problem: No markets found

Solution:

  • Lower your volume filter to 0
  • Try different categories (politics and crypto are most active)
  • Increase the number of markets to fetch

Problem: Can't open HTML file

Solution: Try different commands:

xdg-open polymarket_feed.html # or firefox polymarket_feed.html # or chromium polymarket_feed.html

Understanding Your Results

What Do the Numbers Mean?

Volume: Total amount of money traded. Higher volume = more reliable odds. Markets with $500,000+ volume have better price discovery.

Liquidity: How easy it is to trade without affecting prices. Higher is better for actual trading.

YES/NO Odds: Market-implied probabilities:

  • "YES 65% / NO 35%" = 65% probability the event happens
  • "YES 20% / NO 80%" = only 20% probability it happens

End Date: When the market resolves. After this, the outcome is determined.

Data Analysis Tip: Want to analyze the JSON data? Use jq:
cat polymarket_data.json | jq '.categories.politics[0]'

Pro Tips for Linux Users

  • Bash Alias: Add to ~/.bashrc for quick access: alias pm='cd ~/PolymarketScraper && python3 polymarket1.py'
  • Cron Job: Automate daily updates: 0 9 * * * cd ~/PolymarketScraper && python3 polymarket1.py (runs at 9 AM)
  • JSON Processing: Use jq to parse the JSON output for custom analysis
  • Version Control: Track changes with git: git init && git add . && git commit -m "Initial commit"
  • Virtual Environment: Keep dependencies isolated: python3 -m venv venv && source venv/bin/activate
  • Backup Results: cp polymarket_feed.html "feed_$(date +%Y%m%d).html" before each run

Advanced: Automation & Customization

Create a Bash Script

Save this as run_polymarket.sh:

#!/bin/bash cd ~/PolymarketScraper python3 polymarket1.py firefox polymarket_feed.html &

Make it executable:

chmod +x run_polymarket.sh

Schedule with Cron

Edit crontab:

crontab -e

Add this line for daily 9 AM updates:

0 9 * * * cd ~/PolymarketScraper && python3 polymarket1.py

Parse JSON with jq

jq '.categories.politics[] | select(.volume > 100000)' polymarket_data.json
Linux Power User? You can modify the script to accept command-line arguments, pipe data to other tools, or integrate with your custom dashboard!

Next Steps

Now that you're up and running:

  • Experiment with all 7 categories
  • Adjust filters to find niche markets
  • Track market changes over time
  • Automate with cron jobs
  • Parse JSON data for custom analysis
  • Share HTML reports with non-Linux users (it's cross-platform!)
  • Visit Polymarket.com to explore further
Congratulations! You've successfully set up a Python-based market scraper on Linux. Time to start tracking those predictions!