{"id":21115952,"url":"https://github.com/paritoshtripathi935/GrabFood-Scraper","last_synced_at":"2025-10-01T21:30:28.325Z","repository":{"id":110258963,"uuid":"516983276","full_name":"paritoshtripathi935/GrabFood_Scrapping","owner":"paritoshtripathi935","description":"web scraping of Food Grab website using XHR requests","archived":false,"fork":false,"pushed_at":"2022-08-01T08:09:58.000Z","size":26,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-20T02:03:24.655Z","etag":null,"topics":["chromedriver","food-delivery","python","selenium","web","webscraping","xhr-requests"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paritoshtripathi935.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-23T06:59:26.000Z","updated_at":"2024-09-29T07:06:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"df8a7fc5-745d-4f68-81e0-720843f1ba5c","html_url":"https://github.com/paritoshtripathi935/GrabFood_Scrapping","commit_stats":null,"previous_names":["paritoshtripathi935/grabfood_scrapping"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paritoshtripathi935%2FGrabFood_Scrapping","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paritoshtripathi935%2FGrabFood_Scrapping/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paritoshtripathi935%2FGrabFood_Scrapping/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paritoshtripathi935%2FGrabFood_Scrapping/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paritoshtripathi935","download_url":"https://codeload.github.com/paritoshtripathi935/GrabFood_Scrapping/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225454432,"owners_count":17476822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chromedriver","food-delivery","python","selenium","web","webscraping","xhr-requests"],"created_at":"2024-11-20T02:03:37.070Z","updated_at":"2025-10-01T21:30:22.933Z","avatar_url":"https://github.com/paritoshtripathi935.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\" id=\"top\"\u003e \n  \u003cimg src=\"./.github/app.gif\" alt=\"FoodGrab_Scrapping\" /\u003e\n\n  \u0026#xa0;\n\n  \u003c!-- \u003ca href=\"https://foodgrab_scrapping.netlify.app\"\u003eDemo\u003c/a\u003e --\u003e\n\u003c/div\u003e\n\n\u003ch1 align=\"center\"\u003eFoodGrab_Scrapping\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"Github top language\" src=\"https://img.shields.io/github/languages/top/paritoshtripathi935/Foodgrab_Scrapping?color=56BEB8\"\u003e\n\n  \u003cimg alt=\"Github language count\" src=\"https://img.shields.io/github/languages/count/paritoshtripathi935/Foodgrab_Scrapping?color=56BEB8\"\u003e\n\n  \u003cimg alt=\"Repository size\" src=\"https://img.shields.io/github/repo-size/paritoshtripathi935/Foodgrab_Scrapping?color=56BEB8\"\u003e\n\n  \u003cimg alt=\"License\" src=\"https://img.shields.io/github/license/paritoshtripathi935/Foodgrab_Scrapping?color=56BEB8\"\u003e\n\n  \u003c!-- \u003cimg alt=\"Github issues\" src=\"https://img.shields.io/github/issues/{{YOUR_GITHUB_USERNAME}}/foodgrab_scrapping?color=56BEB8\" /\u003e --\u003e\n\n  \u003c!-- \u003cimg alt=\"Github forks\" src=\"https://img.shields.io/github/forks/{{YOUR_GITHUB_USERNAME}}/foodgrab_scrapping?color=56BEB8\" /\u003e --\u003e\n\n  \u003c!-- \u003cimg alt=\"Github stars\" src=\"https://img.shields.io/github/stars/{{YOUR_GITHUB_USERNAME}}/foodgrab_scrapping?color=56BEB8\" /\u003e --\u003e\n\u003c/p\u003e\n\n\u003c!-- Status --\u003e\n\n\u003c!-- \u003ch4 align=\"center\"\u003e \n\t🚧  FoodGrab_Scrapping 🚀 Under construction...  🚧\n\u003c/h4\u003e \n\n\u003chr\u003e --\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#dart-about\"\u003eAbout\u003c/a\u003e \u0026#xa0; | \u0026#xa0; \n  \u003ca href=\"#sparkles-approach\"\u003eApproach\u003c/a\u003e \u0026#xa0; | \u0026#xa0;\n  \u003ca href=\"#rocket-technologies\"\u003eTechnologies\u003c/a\u003e \u0026#xa0; | \u0026#xa0;\n  \u003ca href=\"#white_check_mark-requirements\"\u003eRequirements\u003c/a\u003e \u0026#xa0; | \u0026#xa0;\n  \u003ca href=\"#checkered_flag-starting\"\u003eStarting\u003c/a\u003e \u0026#xa0; | \u0026#xa0;\n  \u003ca href=\"#memo-license\"\u003eLicense\u003c/a\u003e \u0026#xa0; | \u0026#xa0;\n  \u003ca href=\"https://github.com/{{YOUR_GITHUB_USERNAME}}\" target=\"_blank\"\u003eAuthor\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\n## :dart: About ##\nWeb scraping of Food Grab website using XHR requests\n\n## :sparkles: Approach ##\n\n### Approach - 1\n- in devtools if go to the network tab and click on XHR request, so when i click loadmore button [Food Grab](https://food.grab.com/sg/en/restaurants) we can see this request sent to \"https://portal.grab.com/foodweb/v2/search\"\n\n- so if we go to response section you can see \n```\n{\"searchResult\":{\"searchID\":\"f621f57c6c324a03a9f28eb4231c8395\"\n```\n\n- get restaurant_id from this response, each restaurant_id stored with id key, then when you click on one restaurants a request sent to https://portal.grab.com/foodweb/v2/merchants/{merchnt_id}\n\nwhere 2-CYKCVZNZJTDFLE is ‍restaurant_id‍\n```\n0: {id: \"SGDD00739\", address: {name: \"Lucky Saigon - North Canal Road\"},…}\naddress: {name: \"Lucky Saigon - North Canal Road\"}\nbusinessType: \"FOOD\"\nchainID: \"729_Lucky_Saigon\"\nchainName: \"Lucky Saigon\"\nestimatedDeliveryFee: {currency: {code: \"SGD\", symbol: \"SGD\", exponent: 2}, price: 300, priceDisplay: \"S$3.00\",…}\nestimatedDeliveryTime: 30\nid: \"SGDD00739\"\nlatlng: {latitude: 1.2862877, longitude: 103.84841596}\n```\n\n\n- you can get latitude and longitude from here, make the https://portal.grab.com/foodweb/v2/search request and https://portal.grab.com/foodweb/v2/merchants/{id} with python, but insure all of the http headers must be same with http headers that in the chrome dev tools\n\nbut since use of selenium was requested i tried a diffrent way\n\n### Approach - 2\n- So since i have to capture a XHR(XMLHttpRequest) request, i have used selenium wire for this for capturing the XHR request, i have used chrome driver for this.\n- Solution Desgin \n```\n1. Load the python libraries needed\n2. def load_more - Load the food.grab.com page and automatically activate the \"Load More\" button until the page contains all the restaurants in the Singapore area\n3. def capture_post_response - Use driver to make a POST request for the \"grab_internal_post_api\" and then decode the data and store it in json format in post_data.\n4. def get_restaurant_latlng - remove all the extra and keep name and location only, then store it in a list of dictionaries.\n```\n- Given a base_url, capture all restaurants (based on user's submitted location, e.g., sg) latitude \u0026 longitude\nby intercepting grab-foods internal POST request. self.grab_internal_post_api is found by manually inspecting all XHR made my grab-foods, using chrome dev tools.\n\n- I think aprroach 1 will be easier but will have to pass recapta test i haven't thoufht about this yet.\n\n- I have taken help for various resources since i have to use selenium wire for this and get data from XHR request which i haven't done yet.\n\n## :rocket: Technologies ##\n\nThe following tools were used in this project:\n\n- [Python](https://www.python.org/)\n- [Selenium](https://pypi.org/project/selenium-wire/)\n- [Chromedriver](https://chromedriver.chromium.org/)\n\n## :white_check_mark: Requirements ##\n\nBefore starting :checkered_flag:, you need to have [Git](https://git-scm.com) and [python](https://python.org/) installed.\n\n## :checkered_flag: Starting ##\n\n```bash\n# Clone this project\n$ git clone https://github.com/{{YOUR_GITHUB_USERNAME}}/foodgrab_scrapping\n\n# Access\n$ cd foodgrab_scrapping\n\n# Setup virtual environment\n$ python3 -m venv venv\n\n# Install dependencies\n$ pip install -r requirements.txt\n\n# Run the project\n$ run XHR.py file \n\n```\n\n## :memo: License ##\n\nThis project is under license from MIT. For more details, see the [LICENSE](LICENSE.md) file.\n\n\nMade with :heart: by \u003ca href=\"https://github.com/paritoshtripathi935\" target=\"_blank\"\u003eParitosh Tripathi\u003c/a\u003e\n\n\u0026#xa0;\n\n\u003ca href=\"#top\"\u003eBack to top\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparitoshtripathi935%2FGrabFood-Scraper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparitoshtripathi935%2FGrabFood-Scraper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparitoshtripathi935%2FGrabFood-Scraper/lists"}