Skip to main content

Python package for crawling from Divar website

Project description

Divar

Python package for crawling from Divar website. divar.ir is the biggest website in the middle-east that people post their properties and try to sell them online.

Installation

Simply you can install it from PyPi by following command:

pip install -U divar-scraper

or if you prefer the latest development version, you can install it from the source:

git clone https://github.com/softcoder24/divar.git
cd divar
python setup.py install

Usage

A very simple usage for getting the phone number could be like:

from divar import client

session = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJI................UzI1NiJ9zRumpqq1wrfGpYaD'

divar = client.Divar()

divar.load(session=session)

divar.contact('wXSTyUdO')

Sample response for contact:

09991112233
from divar import client

divar = client.Divar()
divar.post('wXSTyUdO')

Sample response for post:

{
    'title': '۳خوابه امامت۱۴', 
    'description': 'کلا ۴ واحد\nسرامیک\nام دی اف\n۰۹۱۵۱۰۰۳۵۲۴\n۰۹۱۵۲۰۰۳۵۲۴\nرجایی\nهیچ جا خونه ی خود آدم نمیشه',
    'web_url': 'https://divar.ir/v/wXSTyUdO', 
    'price': None, 
    'rent': 1000, 
    'credit': 245000000, 
    'category': 'apartment-rent', 
    'business_type': 'personal', 
    'images': ['https://s100.divarcdn.com/static/pictures/1607624286/wXSTyUdO.webp'], 
    'city': 'مشهد',
    'district': 'آزادشهر'
}
from divar import client

divar = client.Divar()
divar.search(city_code=3, category='real-estate')

Sample response for search:

{
    'last_post_date': 613049590941897, 
    'posts': [
              {'token': 'wXLnEJOQ', 'title': 'فروش زمین باغی در مجتمع شاهنامه محدوده زاک ماریان', 'image': 'https://s100.divarcdn.com/static/thumbnails/1607791740/wXLnEJOQ.webp', 'description': 'توافقی', 'city': 'مشهد', 'district': 'بلوار توس', 'category': 'زمین و کلنگی', 'normal_text': 'لحظاتی پیش در بلوار توس'}, 
              {'token': 'wXULcoir', 'title': 'دفترکار 140متری حاشیه بلوارفردوسی', 'image': '', 'description': 'ودیعه: ۱۰۰,۰۰۰,۰۰۰ تومان\nاجاره ماهیانه: ۴,۰۰۰,۰۰۰ تومان', 'city': 'مشهد', 'district': 'فرامرز عباسی', 'category': 'دفتر کار، اتاق اداری و مطب', 'normal_text': 'لحظاتی پیش در فرامرز عباسی'},
              ...
              {'token': 'wXUL8s-R', 'title': '160متر اپارتمان نوساز حاشیه گلشن ()', 'image': '', 'description': 'ودیعه: ۱۰۰,۰۰۰,۰۰۰ تومان\nاجاره ماهیانه: ۷,۰۰۰,۰۰۰ تومان', 'city': 'مشهد', 'district': 'محله هنرستان', 'category': 'آپارتمان', 'normal_text': 'لحظاتی پیش در محله هنرستان'},
              {'token': 'wXCaNi92', 'title': 'اجاره باغ ویلا واستخرسرپوشیده', 'image': 'https://s100.divarcdn.com/static/thumbnails/1607791726/wXCaNi92.webp', 'description': 'ودیعه: توافقی\nاجاره ماهیانه: توافقی', 'city': 'مشهد', 'district': 'بلوار توس', 'category': 'خانه و ویلا', 'normal_text': 'لحظاتی پیش در بلوار توس'}
             ]
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

divar-scraper-0.1.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

divar_scraper-0.1.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file divar-scraper-0.1.1.tar.gz.

File metadata

  • Download URL: divar-scraper-0.1.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5

File hashes

Hashes for divar-scraper-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4ed1c7ab13e87a12283d666d5a799e6c64dc9b6c83b59c3940776c3fcd79c6b0
MD5 157feda34cb47b0a8b4eb90e4b65563f
BLAKE2b-256 0121d22f86747ad41acd5c6fa422964b23f0170629580eaa6915dafc69d95fca

See more details on using hashes here.

File details

Details for the file divar_scraper-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: divar_scraper-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.5

File hashes

Hashes for divar_scraper-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5324efa4aa8a2672cc4da0e00317ae891d95510ac2bcc3d095829f267cec8c71
MD5 af943c0645a025b53b6b34e0070b9cb7
BLAKE2b-256 8ab6ea94379c4abb3b595c1901dce2ac6cbdc83257d2b8b1fff32dd768abea99

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page