Observed since 20 Oct, 20:03 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
An unofficial API for the community based Irish marketplace, adverts.ie
An unofficial API for the community based Irish marketplace, adverts.ie.
pip install AdvertsAPI
pip install requests
pip install beautifulsoup4
pip install mechanize
import AdvertsAPI
from AdvertsAPI.category import Category
from AdvertsAPI.utils import pretty_json
Default: category=None, county=None, min_price=0, max_price=0, view='grid_view', search=None
advert = AdvertsAPI.AdvertsAPI()
Bike in Dublin: category=Category.SPORTS_FITNESS__BIKES, county='Dublin', min_price=0, max_price=0, view='grid_view', search=None
advert = AdvertsAPI.AdvertsAPI(category=Category.SPORTS_FITNESS__BIKES, county='Dublin')
Mountain bike in Dublin: category=Category.SPORTS_FITNESS__BIKES, county='Dublin', min_price=0, max_price=0, view='grid_view', search='mountain'
advert = AdvertsAPI.AdvertsAPI(category=Category.SPORTS_FITNESS__BIKES, county='Dublin', search='mountain')
ps4 between 100-300 euro: category=Category.CONSOLES_GAMES, county=None, min_price=100, max_price=300, view='grid_view', search='ps4'
advert = AdvertsAPI.AdvertsAPI(category=Category.CONSOLES_GAMES, min_price=100, max_price=300, search='ps4')
free items in Dublin: category=None, county='Dublin', min_price=0, max_price=0, view='grid_view', search=None
advert = AdvertsAPI.AdvertsAPI(county='Dublin')
adverts = AdvertsAPI.AdvertsAPI()
adverts.login('username', 'password')
NOTE: given the contructor details, it will produce the url for the search.
ads = advert.get_ad_panel()
However you could also pass in the url of the search and it will compute for you.
ads = advert.get_ad_panel('https://www.adverts.ie/for-sale/price_0-0/')
It will return a list of the top 30 ads for that search. The attributes that can be retreived are: price, title, area, county, category and url
for ad in ads:
print(ad.price)
print(ad.title)
print(ad.area)
print(ad.county)
print(ad.category)
print(ad.url)
This will place an offer given the url of the ad directly.
Below is an example given a url that is static.
advert.place_offer('ad_url', 100)
Below will place an offer on the first ad of the ads retreieved above.
advert.place_offer(ads[0].url, 0)
Withdraws an offer to a particular ad, given the url. You must have an active offer to withdraw the ad.
advert.withdraw_offer('ad_url')
This will return all the information of the ad given the url. The attributes that can be retreived are: title, price, seller, positive, negative, location date_entered, ad_views and description.
advert.full_ad_info('ad_url')
ads = advert.full_ad_info(ads[0].url)
You can retreive the data as follows:
for ad in ads:
print(ad.title)
print(ad.price)
print(ad.seller)
print(ad.positive)
print(ad.negative)
print(ad.location)
print(ad.date_entered)
print(ad.ad_views)
print(ad.description)
Search query will use the constructor generated url to search for ads.
advert.search_query()
However you can pass a search query to the method and it will return the search results of the query.
# search_query (given query)
ads = advert.search_query('mountain bikes')
Similar to the get_ad_panel method, you can retreive the data as below:
for ad in ads:
print(ad.title)
# ...
print(ad.url)
Not very necessary as it will discard the cookies as the program stops.
adverts.logout()
For documented examples see examples.py
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
See the open issues for a list of proposed features (and known issues).
Distributed under the MIT License. See LICENSE for more information.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 1.0.1 | 26 Dec 2020 | 0 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 20:03 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:6beebcbb14230b2385f8f4950ff5815e1ac621d9078010fddd4a680e7467bb07