Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
starbucks korea store list crawling
#!/usr/bin/env python
import bs4
import requests
import time
def main():
for sido_idx in range(1,18):
sido = str(sido_idx).zfill(2)
gugun_idx = 0
goto_sido = False
while True:
if goto_sido is True:
gugun_idx += 1
gugun = str(gugun_idx).zfill(2)
page_idx = -1
while True:
page_idx += 1
r ="",
{"sido" : sido, "gugun": sido + gugun, "PageNo": str(page_idx)})
b = bs4.BeautifulSoup(r.text)
items = b.find_all("ul",class_="storeSeachList")[0].find_all("ul")
if len(items) == 0:
if page_idx == 0:
goto_sido = True
for item in items:
addr = item.find_all("li")[1].text
open("starbucks.text",'a').write(addr.encode("utf8") + "\n")
if __name__ == '__main__':

This comment has been minimized.

Copy link

littmus commented Jan 28, 2015

이디야 커피 매장 리스트 입니다. 커피에선 롯데리아 대신 사용할 수 있을것 같아요.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.