Name | DivarApi JSON |
Version |
0.0.3
JSON |
| download |
home_page | |
Summary | Unofficial api of Divar - by Reverse Engineering |
upload_time | 2023-08-19 19:40:37 |
maintainer | |
docs_url | None |
author | RealPalas |
requires_python | >=3.9 |
license | |
keywords |
python
divar
api
iran
web scraping
bot
palas
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# DivarApi 🇮🇷
Under construction! Not compelitly ready for use yet! Currently experimenting and planning!
English / [فارسی - Farsi](README_fa.md)
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
```python
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 :
```python
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:
```python
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 ❤️
Raw data
{
"_id": null,
"home_page": "",
"name": "DivarApi",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "",
"keywords": "python,divar,api,iran,web scraping,bot,palas",
"author": "RealPalas",
"author_email": "palasongithub@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/31/ed/4f8ff996d1a1c4d86b491a343a0782eda7aa8850ae3a1dafb7cb8db1db83/DivarApi-0.0.3.tar.gz",
"platform": null,
"description": "\r\n# DivarApi \ud83c\uddee\ud83c\uddf7\r\n\r\n\r\n\r\nUnder construction! Not compelitly ready for use yet! Currently experimenting and planning! \r\n\r\n\r\n\r\nEnglish / [\u0641\u0627\u0631\u0633\u06cc - Farsi](README_fa.md)\r\n\r\n\r\n\r\nDeveloped by Palas - 2023\r\n\r\n\r\n\r\n# Examples - getting newest annon from a city (Buggy Alpha Version)\r\n\r\n\r\n\r\n## 1. Install the pkg using pip\r\n\r\n```\r\n\r\npip3 install DivarApi\r\n\r\n```\r\n\r\n\r\n\r\nCreating A Client\r\n\r\n\r\n\r\n```python\r\n\r\nfrom DivarApi.core import Client\r\n\r\n\r\n\r\nBot = Client()\r\n\r\n# on this example we want to get the data from mashhad city and buy-apartment category\r\n\r\nBot.get_newest_category('mashhad' , 'buy-apartment')\r\n\r\n\r\n\r\n# it returns a bs4 instance , you can specify if you want to have it as json with jsonify = true argument and more...\r\n\r\n```\r\n\r\n\r\n\r\n## Getting Number from Token and id\r\n\r\nEvery post and annon in Divar.ir contains a Token that you can use to get phone number \r\n\r\n\r\n\r\ne.x -> https://divar.ir/v/title/AZgVLMTF\r\n\r\nToken is after the title (end of the url) and in this example its { AZgVLMTF }\r\n\r\nyou can get the phone number using the get_number method as :\r\n\r\n\r\n\r\n```python\r\n\r\nfrom DivarApi.core import Client\r\n\r\n\r\n\r\nBot = Client()\r\n\r\n\r\n\r\n# if method doesnt work correctly plz use your own jwt token in header\r\n\r\nBot.get_number(AZgVLMTF)\r\n\r\n# if this token exists and has a phone number youll get it \r\n\r\n# but if the number is hidden , itll returns Hidden Number!\r\n\r\n```\r\n\r\n\r\n\r\n## Getting Image of a post ( annon )\r\n\r\nTo use this feature you should pass an ID and Token of a post , also you should specify headers fully\r\n\r\nhow to get ID of a post?\r\n\r\nin 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 :\r\n\r\n\r\n\r\nhttps://s101.divarcdn.com/static/pictures/1692404705/AZVD2hGi.jpg\r\n\r\n\r\n\r\nin this example , the id is 1692404705 and the token is AZVD2hGi\r\n\r\nso you can get the image through get_post_pic:\r\n\r\n\r\n\r\n```python\r\n\r\nfrom DivarApi.core import Client\r\n\r\n\r\n\r\nBot = Client(header:dict)\r\n\r\nBot.get_post_pic(1692404705 , 'AZVD2hGi' , path = 'E:\\\\download\\basefolder')\r\n\r\n\r\n\r\n#if your jwt token which should be in cookie inside header was expired you'll get this error:\r\n\r\n#the cookie you specified is not correct! or jwt is expired\r\n\r\n# or if the link was incorrect you'll get statuscode - Bad request\r\n\r\n\r\n\r\n```\r\n\r\n## On Developing state which means its not stable completly.\r\n\r\n## star the rep on github \u2764\ufe0f\r\n\r\n\r\n\r\n\r\n\r\n",
"bugtrack_url": null,
"license": "",
"summary": "Unofficial api of Divar - by Reverse Engineering",
"version": "0.0.3",
"project_urls": null,
"split_keywords": [
"python",
"divar",
"api",
"iran",
"web scraping",
"bot",
"palas"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f86cba336037bd20b3b14e3a3614b93e789fafc5eaa69a9a01d76d14c13e4efd",
"md5": "8ca6394baf1090095d8a2149d5980d93",
"sha256": "1b68a844ca4ff25e7d737943840eb25ad02f2b8aa8ec40d48f1f0a0ed6d974a3"
},
"downloads": -1,
"filename": "DivarApi-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8ca6394baf1090095d8a2149d5980d93",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 5822,
"upload_time": "2023-08-19T19:40:35",
"upload_time_iso_8601": "2023-08-19T19:40:35.445431Z",
"url": "https://files.pythonhosted.org/packages/f8/6c/ba336037bd20b3b14e3a3614b93e789fafc5eaa69a9a01d76d14c13e4efd/DivarApi-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "31ed4f8ff996d1a1c4d86b491a343a0782eda7aa8850ae3a1dafb7cb8db1db83",
"md5": "63063209a8496797bf9a724356ec4c92",
"sha256": "c1a707548e966346abb6d03856f609e044d07b0409e25b138828f0fb64a43b83"
},
"downloads": -1,
"filename": "DivarApi-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "63063209a8496797bf9a724356ec4c92",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 5749,
"upload_time": "2023-08-19T19:40:37",
"upload_time_iso_8601": "2023-08-19T19:40:37.070252Z",
"url": "https://files.pythonhosted.org/packages/31/ed/4f8ff996d1a1c4d86b491a343a0782eda7aa8850ae3a1dafb7cb8db1db83/DivarApi-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-19 19:40:37",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "divarapi"
}