mirror of
https://github.com/etienne-hd/lbc.git
synced 2025-12-16 06:21:32 +01:00
get_ad & get_user functions, extended user info (badges, feedback, pro), and new usage examples
This commit is contained in:
21
examples/search_with_url.py
Normal file
21
examples/search_with_url.py
Normal file
@@ -0,0 +1,21 @@
|
||||
"""Search for ads on Leboncoin using a full search URL."""
|
||||
|
||||
import lbc
|
||||
|
||||
def main() -> None:
|
||||
# Initialize the Leboncoin API client
|
||||
client = lbc.Client()
|
||||
|
||||
# Perform a search using a prebuilt Leboncoin URL
|
||||
result = client.search(
|
||||
url="https://www.leboncoin.fr/recherche?category=10&text=maison&locations=Paris__48.86023250788424_2.339006433295173_9256_30000",
|
||||
page=1,
|
||||
limit=35
|
||||
)
|
||||
|
||||
# Print basic info about each ad
|
||||
for ad in result.ads:
|
||||
print(f"{ad.id} | {ad.url} | {ad.subject} | {ad.price}€ | Seller: {ad.user}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user