-
-
Save bahrammp/32417bee2122dc33c9bac60fe8e5ee93 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_restaurants_list(page=1): | |
global counter | |
http = urllib3.PoolManager() | |
base_api_url = 'https://www.snappfood.ir/restaurant/?page={}' | |
r = http.request('GET', base_api_url.format(page)) | |
soup = BeautifulSoup(r.data.decode('utf-8'),'lxml') | |
restaurant_links = soup.find_all('div',class_='kk-pp-title') | |
res = list() | |
for i in restaurant_links: | |
res.append(i.find_all('a')[0]['href']) # get link of restaurant's page | |
counter+=1 | |
print(counter) | |
return res; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment