Aller au contenu
Toutes les missions
Veille marché · Dev-to Nouvelle Publiée il y a 20 heures

How to Pull Middle East Job Listings from Bayt.com with Bayt Scraper

By the end of this tutorial you will have a short Python script that pulls job listings from Bayt, the Middle East job board, into structured rows. Each row holds the job title, the company,...

Entreprise most
Mode Sur site

Résumé

By the end of this tutorial you will have a short Python script that pulls job listings from Bayt, the Middle East job board, into structured rows. Each row holds the job title, the company, the location, the country, how long ago the job was posted and the link to the listing. You do not need to write any scraping code yourself. Bayt Scraper (reventadata/bayt-scraper) is the Apify Actor built for this site. You give it a search phrase, such as python, and it returns one row per job. This guide calls it from Python with the Apify client. The Actor is not affiliated with Bayt. It reads public search pages without a login. Prerequisites You need three things: Python 3, with the Apify client installed. A free Apify account. You can sign up on the Apify site. Your Apify API token, from your Apify account. Install the client and export the token: pip install -U "apify-client~=3.0" export APIFY_API_TOKEN="your_apify_token_here" No browser automation is needed on your side. The Actor reads the public pages for you. What you'll achieve You will search Bayt for python, read the rows in Python and print two lines per job. The first line holds the title, the company, the location and the country. The second line holds the posting age and the link to the listing. Because every row has the same fields, you can sort the output by company or country afterwards, or paste it into a spreadsheet. To search for another phrase, change one value in the script and nothing else. A short snippet in Step 5 saves the rows to a CSV file, so the list can leave Python and go into a spreadsheet. Step 1: Open Bayt Scraper Open the Bayt Scraper page on Apify Store. This tutorial calls the Actor from Python, so the name reventadata/bayt-scraper is all you need from that page. Step 2: Choose the search The Actor takes two input fields: query: the search phrase. Required. Extra spaces between words are collapsed, and a phrase longer than 120 characters is rejected. maxItems: the most rows to store. Left unset, it defaults to 100. The minimum is 1. Each search returns one page of up to 30 results, so a maxItems above 30 does not add rows. The sample input below is the one the Actor's input form pre-fills: {"query": "python", "maxItems": 10} Step 3: Run it from Python This script starts the Actor, waits for it to finish, reads the dataset and prints two lines per job: import os from apify_client import ApifyClient # 1. Initialise the client with your token from the environment client = ApifyClient(os.environ["APIFY_API_TOKEN"]) # 2. Describe the search: python jobs, at most 10 rows run_input = {"query": "python", "maxItems": 10} # 3. Start the Actor and wait for it to finish run = client.actor("reventadata/bayt-scraper").call(run_input=run_input) if run is None or run.status != "SUCCEEDED": status = run.status if run else "unknown" raise SystemExit(f"Run did not succeed (status: {status}).") # 4. Read the rows from the run's default dataset items = client.dataset(run.default_dataset_id).list_items().items print(f"Retrieved {len(items)} jobs.\n") # 5. Print two lines per job for item in items: print(f"{item['title']} at {item['company']}, {item['location']}, {item['country']}") print(f" posted: {item['posted']} {item['url']}") To search for something else, change the phrase in query. Here is what the script does, in order. It builds the client from your token, so the token never sits in the file. It describes the search as a small dictionary. It starts the Actor with call(), which waits until the run finishes and returns the finished run. If the run did not succeed, the script stops and prints the status, so it never reads a dataset that was not filled. Otherwise it reads the rows from the run's default dataset and prints two lines per job. Step 4: Read the output Each row is a JSON object. The example run of 27 November 2026 used exactly this input (python, maxItems 10) and stored 10 rows. This is the first of them, whole: { "id": "5514243", "title": "Application Lead - Digital Engineering | Corporate Services | GTDP", "url": "https://www.bayt.com/en/uae/jobs/application-lead-digital-engineering-corporate-services-gtdp-5514243/", "company": "Al Futtaim Group", "location": "Dubai", "country": "UAE", "posted": "5 hours ago", "matchedQuery": "python", "scrapedAt": "2026-11-27T14:27:35.890329+00:00" } Step 5: Save the rows to a CSV file This snippet continues the script from Step 3 and writes the rows to a CSV file: import csv # Save the rows from Step 3 to a CSV file fields = ["id", "title", "url", "company", "location", "country", "posted", "matchedQuery", "scrapedAt"] with open("bayt_jobs.csv", "w", newline="", encoding="utf-8") as f: writer = csv.DictWriter(f, fieldnames=fields) writer.writeheader() writer.writerows(items) Understanding your results These are the fields you will use most: title: the job title. company, location, country: the hiring company, the city or area and the country, as the site shows them. Each can be null when the site shows none. posted: the posting age as the site shows it, such as 5 hours ago. It is text, not a date. url: the link to the listing on Bayt. Use it to open the job or to recognise it again in a later run. id: the job identifier on the site. Rows in one run are not repeated: a job whose id was already stored is skipped. matchedQuery: the search phrase that produced the row. scrapedAt: the time the row was read, in ISO 8601. Every row in the sample has all nine fields, and the same nine names apply to every phrase, so one script reads every search. Pro tips and advanced usage Start small. Keep maxItems at 10 while you check the output, then raise it up to 30. Search by phrase, then filter yourself. The Actor has no location or company filter, so filter the rows in Python by country or location. Keep the link. The url field links straight to the job, so store it with your own notes. Run several phrases. The Actor takes one phrase per run. Call it once per phrase in a loop, and use the matchedQuery field to see which phrase produced each row. Compare two runs. Run the same phrase on two days and compare the two lists by url to see which jobs are new. Read the age as text. posted is the age as the site shows it, such as 5 hours ago or 10 days ago, so sort by it only after you convert it yourself. Troubleshooting common issues The run did not succeed. Open the run in the Apify Console and read its log. The script prints the run status and stops. Fewer rows than maxItems. One search returns one page of up to 30 results, so a larger maxItems cannot return more. A phrase with no matching jobs stores no rows at all. A field is null. company, location, country and posted are null when the site shows no value for that job. Handle that in your code, for example with item.get("company"). The run ended at once with an input error. query is required and maxItems must be at least 1. Next steps Once the rows look right, open the CSV file in a spreadsheet, or load it into a database with your own code. Then try a second phrase and compare the two result lists by url. For current pricing and details, see the Store page. Which phrase will you search on Bayt? Drop a comment below. About the author: reventadata builds and publishes data extraction Actors on the Apify Store.