Unofficial api of Divar - by Reverse Engineering
Project description
DivarApi 🇮🇷
Under construction! Not compelitly ready for use yet! Currently experimenting and planning!
English / فارسی - Farsi
Developed by Palas - 2023
Examples - getting newest annon from a city (Buggy Alpha Version)
1. Install the pkg using pip
pip3 install DivarApi
Creating A Client
from DivarApi.core import Client
Bot = Client()
# on this example we want to get the data from mashhad city and buy-apartment category
Bot.get_newest_category('mashhad' , 'buy-apartment')
# it returns a bs4 instance , you can specify if you want to have it as json with jsonify = true argument and more...
Getting Number from Token and id
Every post and annon in Divar.ir contains a Token that you can use to get phone number
e.x -> https://divar.ir/v/title/AZgVLMTF
Token is after the title (end of the url) and in this example its { AZgVLMTF }
you can get the phone number using the get_number method as :
from DivarApi.core import Client
Bot = Client()
# if method doesnt work correctly plz use your own jwt token in header
Bot.get_number(AZgVLMTF)
# if this token exists and has a phone number youll get it
# but if the number is hidden , itll returns Hidden Number!
Getting Image of a post ( annon )
To use this feature you should pass an ID and Token of a post , also you should specify headers fully
how to get ID of a post?
in every image link related to a post you can find it , also you can use the get_newest_category() and there you can find related field get tagged there before the token , i mean :
https://s101.divarcdn.com/static/pictures/1692404705/AZVD2hGi.jpg
in this example , the id is 1692404705 and the token is AZVD2hGi
so you can get the image through get_post_pic:
from DivarApi.core import Client
Bot = Client(header:dict)
Bot.get_post_pic(1692404705 , 'AZVD2hGi' , path = 'E:\\download\basefolder')
#if your jwt token which should be in cookie inside header was expired you'll get this error:
#the cookie you specified is not correct! or jwt is expired
# or if the link was incorrect you'll get statuscode - Bad request
On Developing state which means its not stable completly.
star the rep on github ❤️
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file DivarApi-0.0.3.tar.gz.
File metadata
- Download URL: DivarApi-0.0.3.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1a707548e966346abb6d03856f609e044d07b0409e25b138828f0fb64a43b83
|
|
| MD5 |
63063209a8496797bf9a724356ec4c92
|
|
| BLAKE2b-256 |
31ed4f8ff996d1a1c4d86b491a343a0782eda7aa8850ae3a1dafb7cb8db1db83
|
File details
Details for the file DivarApi-0.0.3-py3-none-any.whl.
File metadata
- Download URL: DivarApi-0.0.3-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b68a844ca4ff25e7d737943840eb25ad02f2b8aa8ec40d48f1f0a0ed6d974a3
|
|
| MD5 |
8ca6394baf1090095d8a2149d5980d93
|
|
| BLAKE2b-256 |
f86cba336037bd20b3b14e3a3614b93e789fafc5eaa69a9a01d76d14c13e4efd
|