Skip to content

Instantly share code, notes, and snippets.

View Irfan-Ahmad-byte's full-sized avatar

Irfan Ahmad Irfan-Ahmad-byte

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import requests
from bs4 import BeautifulSoup as bs
import pandas as pd
root_url = "https://www2.reservebar.com" # products' addresses will be appended to this root URL
payload={} # an empty data payload
# headers for our request
headers = {
'authority': 'www2.reservebar.com',
#defining anticaptcha function
def acp_api_send_request(driver, message_type, data={}):
message = {
# this receiver has to be always set as antiCaptchaPlugin
'receiver': 'antiCaptchaPlugin',
# request type, for example setOptions
'type': message_type,
# merge with additional data
**data
}
from selenium import webdriver
from selenium.webdriver import Chrome, ChromeOptions, Remote, FirefoxOptions
from selenium.webdriver.common.by import By
import requests
from selenium.webdriver.support.wait import WebDriverWait
from selenium.common.exceptions import NoSuchElementException
import time
options = ChromeOptions()
@Irfan-Ahmad-byte
Irfan-Ahmad-byte / fiverr.ipynb
Last active March 2, 2022 10:20
In this notebook I scraped gigs data from fiverr.com. It is not well commented cuz it was my first experience with python development and scripting with jupyter.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Irfan-Ahmad-byte
Irfan-Ahmad-byte / doordash3.py
Created February 24, 2021 12:34
This script is the last one which scrapes menus from doordash.com and stores the data in a JSON file with proper format. It creates main Node with Store name, then assigns sub-nodes of food categories in the store to the sub-node.
# Started: 2/9/21, target: 2/11/21
# importing libraries
import ctypes
import json
import sys
import time
from typing import List
import selenium.webdriver
from selenium.webdriver import ActionChains
@Irfan-Ahmad-byte
Irfan-Ahmad-byte / doordash2.2.py
Created February 24, 2021 12:31
This script also scrapes doordash.com. But, have three differences.
# # This version of dordash scraping code has only 2 differences with doordash 2.1.
# 1- can add a manual string for location in the terminal, with the script name
# 2- end process on completion of target
# 3- can scroll to the particular target at any location, without bothering its coordinates
# importing required libraries
import ctypes
import time
from typing import List
import pandas as pd
@Irfan-Ahmad-byte
Irfan-Ahmad-byte / doordash2.1.py
Created February 24, 2021 12:27
This script is different from doordashmenu scraping only in the way that it does not support manual location string. Gist 1 has some fault, which has been corrected in this Gist.
# This version of doordash scraping contains an improvement to doordash 2.0, which
# failed to scrape.
# But, this does not includes the manual string option for stores' location
# Restaurants' Menu Scraping (doordash.com) [operation 1]
# This scraper will navigate to doordash.com. Then it will browse for a specific food type at
# the bottom of the main page under the "Top Cuisines Near You" tab. After the page is loaded, it
# will first evaluate the number of pages for the searched project at a specific location and then
# total number of stores per page. As a next step, it will loop through all the stores and all the
@Irfan-Ahmad-byte
Irfan-Ahmad-byte / doordash_Menu_Scraping-no_location_option.py
Created February 24, 2021 12:19
This script scrapes menus from doordash.com at a pre-selected location i.e New York.
# Restaurants' Menu Scraping (doordash.com) [operation 1]
# This scraper will navigate to doordash.com. Then it will browse for a specific food type at
# the bottom of the main page under the "Top Cuisines Near You" tab. After the page is loaded, it
# will first evaluate the number of pages for the searched project at a specific location and then
# total number of stores per page. As a next step, it will loop through all the stores and all the
# pages until our scraping target is hit.
# This approach will enter the location name with script name to run and scrape menus from stores
# at that location///
# importing required libraries
@Irfan-Ahmad-byte
Irfan-Ahmad-byte / doordash_Menu_Scraping.py
Last active October 22, 2022 06:05
This project scrapes menus from food stores at a particular location. This location string is specifies after the name of the script when running from terminal.
# Restaurants' Menu Scraping (doordash.com) [operation 2]
# This scraper will navigate to doordash.com. Then it will browse to for a specific food type at
# the bottom of the main page under the "Top Cuisines Near You" tab. After the page is loaded, it
# will first evaluate the number of pages for the searched project at a specific location and then
# total number of stores per page. As a next step, it will loop through all the stores and all the
# pages until our scraping target is hit.
# This approach will enter the location name with script name to run and scrape menus from stores
# at that location///
# importing required libraries