Created
January 14, 2023 15:56
-
-
Save alsak0de/9bb96e86bb5b8868ff4b4c2cd9dea749 to your computer and use it in GitHub Desktop.
Whatsapp scraper with rapidapi (free version)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
# refustered function returns a boolean value | |
def WSP_registered_free(token, phone, apikey): | |
url = "https://whatsapp-scraper.p.rapidapi.com/free/wchk" | |
querystring = {"phone":phone, "token":token} | |
headers = { | |
"X-RapidAPI-Key": apikey, | |
"X-RapidAPI-Host": "whatsapp-scraper.p.rapidapi.com" | |
} | |
return bool(requests.request("GET", url, headers=headers, params=querystring).json()) | |
# about function returns a json object | |
def WSP_about_free(token, phone, apikey): | |
url = "https://whatsapp-scraper.p.rapidapi.com/free/about" | |
querystring = {"phone":phone,"token":token} | |
headers = { | |
"X-RapidAPI-Key": apikey, | |
"X-RapidAPI-Host": "whatsapp-scraper.p.rapidapi.com" | |
} | |
return requests.request("GET", url, headers=headers, params=querystring).json() | |
# Isbiz returns a boolean value | |
def WSP_isbiz_free(token, phone, apikey): | |
url = "https://whatsapp-scraper.p.rapidapi.com/free/isbiz" | |
querystring = {"phone":phone,"token":token} | |
headers = { | |
"X-RapidAPI-Key": apikey, | |
"X-RapidAPI-Host": "whatsapp-scraper.p.rapidapi.com" | |
} | |
return bool(requests.request("GET", url, headers=headers, params=querystring).json()) | |
# Bizinfo returns a json object | |
def WSP_bizinfo_free(token, phone, apikey): | |
url = "https://whatsapp-scraper.p.rapidapi.com/free/bizinfo" | |
querystring = {"phone":phone,"token":token} | |
headers = { | |
"X-RapidAPI-Key": apikey, | |
"X-RapidAPI-Host": "whatsapp-scraper.p.rapidapi.com" | |
} | |
return requests.request("GET", url, headers=headers, params=querystring).json() | |
# Valid values for pictype are 'url', 'base64' and 'png'. | |
# Valid values for quality are 'high' and 'low' | |
def WSP_profilepic_free(token, phone, apikey,pictype="url", quality="high"): | |
url = "https://whatsapp-scraper.p.rapidapi.com/free/wspicture" | |
querystring = {"phone":phone,"pictype":pictype,"quality":quality,"token":token} | |
headers = { | |
"X-RapidAPI-Key": apikey, | |
"X-RapidAPI-Host": "whatsapp-scraper.p.rapidapi.com" | |
} | |
return requests.request("GET", url, headers=headers, params=querystring) | |
mytoken = " " | |
myapikey="" | |
phone = "34655719560" | |
print ("Is "+phone+" a Whatsapp registered number? : "+str(WSP_registered_free(mytoken,phone,myapikey))) | |
print ("\nWhats's the status of "+phone+" and when was it set up?\n"+str(WSP_about_free(mytoken,phone,myapikey))) | |
print ("\nDoes the line "+phone+" correspond to a Business account? : "+str(WSP_isbiz_free(mytoken,phone,myapikey))) | |
print ("\nURL link to high-res WA-Profile-Picture:\n"+ WSP_profilepic_free(mytoken,phone,myapikey,"url","high").text) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment