mugoosse / perplexity-ai

Unofficial API Wrapper for Perplexity.ai + Account Generator

Home Page:https://perplexity.ai

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Perplexity.ai

This module is simply just an API Wrapper and account generator. So it's an API Wrapper with free copilots.

How It Works

This module uses emailnator to generate new accounts. As you know, when you create a new account, you will have 5 copilots. That's how it works! This module will generate you new gmails (using @googlemail.com right now) with emailnator and you will have UNLIMITED COPILOTS!

Requirements

Install requirements with:

pip3 install -r requirements.txt

or with single-line command:

pip3 install requests&&pip3 install beautifulsoup4&&pip3 install lxml&&pip3 install websocket-client

How To Use

First thing first, Perplexity.ai is protected by cloudflare, and emailnator too. We need to open this pages manually and get the cookies. And do not forget these cookies are temporary, so you need to renew them continuously. Here how to get your cookies.

import perplexity

perplexity_headers = <your headers here>
perplexity_cookies = <your cookies here>

emailnator_headers = <your headers here>
emailnator_cookies = <your cookies here>


perplexity_cli = perplexity.Client(perplexity_headers, perplexity_cookies)
perplexity_cli.create_account(emailnator_headers, emailnator_cookies) # Creates a new gmail, so your 5 copilots will be renewed. You can pass this one if you are not going to use "copilot" mode

# modes = ['concise', 'copilot']
# focus = ['internet', 'scholar', 'writing', 'wolfram', 'youtube', 'reddit', 'wikipedia']
print(perplexity_cli.search('Your query here', mode='copilot', focus='internet'))

# perplexity_cli.create_account(emailnator_headers, emailnator_cookies) # Call this function when you're out of copilots

How To Get The Cookies

Do not forget these cookies are temporary, so you need to renew them continuously.

  1. Open emailnator website. Click F12 or Ctrl + Shift + I to open inspector. Check "Preserve log" button, go to the "Network" tab in the inspector, click the "Go !" button in the website, right click the "message-list" in the Network Tab and hover on "Copy" and click to "Copy as cURL (bash)". Now go to the curlconverter, paste your code here. The header and cookies dictionary will appear, copy them and use in your codes.

  1. Open Perplexity.ai website. Sign out if you're signed in. Click F12 or Ctrl + Shift + I to open inspector. Check "Preserve log" button, go to the "Network" tab in the inspector, click the "Sign Up" button in the website, write a random email and click "Continue with Email" button, right click the "email" in the Network Tab and hover on "Copy" and click to "Copy as cURL (bash)". Now go to the curlconverter, paste your code here. The header and cookies dictionary will appear, copy them and use in your codes.

  1. Don't confuse the headers and cookies for emailnator and Perplexity.ai, look at How To Use to learn how to use them.

Thanks To

About

Unofficial API Wrapper for Perplexity.ai + Account Generator

https://perplexity.ai

License:MIT License


Languages

Language:Python 100.0%