import os
from urllib.request import urlopen, urlretrieve
from bs4 import BeautifulSoup

RESULT_PATH = os.path.join('.', 'yes_imgs')
if not os.path.exists(RESULT_PATH):
    os.mkdir(RESULT_PATH)

with open('./result.tsv', 'w') as rf:
    for page in range(1, 20):
        print('page: %d' % page)
        URL = 'http://www.the35mm.com/product/list.html?cate_no=24&sort_method=3&page=%d' % page

        soup = BeautifulSoup(urlopen(URL), 'lxml')
        names = soup.find_all('p', class_='name')
        total_size = len(names)
        loop_cnt = 1
        for name in names:
            print('%d/%d' % (loop_cnt, total_size))
            test_link ='http://www.the35mm.com' + name.find('a').get('href')
            equipment_name = name.strong.a.find_all('span')[2].text.strip()
            test_soup = BeautifulSoup(urlopen(test_link), 'lxml')
            if not test_soup.find('img', attrs={'alt': '바로구매하기'}).find_parent('a', class_='displaynone'):
                rf.write('%s\t%s\tYES\n' % (equipment_name, test_link))
                img_src = 'http:' + test_soup.find('img', class_='BigImage').get('src')
                img_name = equipment_name.replace('.', '_').replace('?', '_').replace('!', '_').replace('/', '_') + '.jpg'
                urlretrieve(img_src, os.path.join(RESULT_PATH, img_name))
            else:
                rf.write('%s\t%s\tNO\n' % (equipment_name, test_link))
            loop_cnt += 1

d67f2dd859f8d25a4795b42d6c20589b8867b77b
<mask token>

<mask token>
if not os.path.exists(RESULT_PATH):
    os.mkdir(RESULT_PATH)
with open('./result.tsv', 'w') as rf:
    for page in range(1, 20):
        print('page: %d' % page)
        URL = (
            'http://www.the35mm.com/product/list.html?cate_no=24&sort_method=3&page=%d'
             % page)
        soup = BeautifulSoup(urlopen(URL), 'lxml')
        names = soup.find_all('p', class_='name')
        total_size = len(names)
        loop_cnt = 1
        for name in names:
            print('%d/%d' % (loop_cnt, total_size))
            test_link = 'http://www.the35mm.com' + name.find('a').get('href')
            equipment_name = name.strong.a.find_all('span')[2].text.strip()
            test_soup = BeautifulSoup(urlopen(test_link), 'lxml')
            if not test_soup.find('img', attrs={'alt': '바로구매하기'}).find_parent(
                'a', class_='displaynone'):
                rf.write('%s\t%s\tYES\n' % (equipment_name, test_link))
                img_src = 'http:' + test_soup.find('img', class_='BigImage'
                    ).get('src')
                img_name = equipment_name.replace('.', '_').replace('?', '_'
                    ).replace('!', '_').replace('/', '_') + '.jpg'
                urlretrieve(img_src, os.path.join(RESULT_PATH, img_name))
            else:
                rf.write('%s\t%s\tNO\n' % (equipment_name, test_link))
            loop_cnt += 1

<mask token>
RESULT_PATH = os.path.join('.', 'yes_imgs')
if not os.path.exists(RESULT_PATH):
    os.mkdir(RESULT_PATH)
with open('./result.tsv', 'w') as rf:
    for page in range(1, 20):
        print('page: %d' % page)
        URL = (
            'http://www.the35mm.com/product/list.html?cate_no=24&sort_method=3&page=%d'
             % page)
        soup = BeautifulSoup(urlopen(URL), 'lxml')
        names = soup.find_all('p', class_='name')
        total_size = len(names)
        loop_cnt = 1
        for name in names:
            print('%d/%d' % (loop_cnt, total_size))
            test_link = 'http://www.the35mm.com' + name.find('a').get('href')
            equipment_name = name.strong.a.find_all('span')[2].text.strip()
            test_soup = BeautifulSoup(urlopen(test_link), 'lxml')
            if not test_soup.find('img', attrs={'alt': '바로구매하기'}).find_parent(
                'a', class_='displaynone'):
                rf.write('%s\t%s\tYES\n' % (equipment_name, test_link))
                img_src = 'http:' + test_soup.find('img', class_='BigImage'
                    ).get('src')
                img_name = equipment_name.replace('.', '_').replace('?', '_'
                    ).replace('!', '_').replace('/', '_') + '.jpg'
                urlretrieve(img_src, os.path.join(RESULT_PATH, img_name))
            else:
                rf.write('%s\t%s\tNO\n' % (equipment_name, test_link))
            loop_cnt += 1

import os
from urllib.request import urlopen, urlretrieve
from bs4 import BeautifulSoup
RESULT_PATH = os.path.join('.', 'yes_imgs')
if not os.path.exists(RESULT_PATH):
    os.mkdir(RESULT_PATH)
with open('./result.tsv', 'w') as rf:
    for page in range(1, 20):
        print('page: %d' % page)
        URL = (
            'http://www.the35mm.com/product/list.html?cate_no=24&sort_method=3&page=%d'
             % page)
        soup = BeautifulSoup(urlopen(URL), 'lxml')
        names = soup.find_all('p', class_='name')
        total_size = len(names)
        loop_cnt = 1
        for name in names:
            print('%d/%d' % (loop_cnt, total_size))
            test_link = 'http://www.the35mm.com' + name.find('a').get('href')
            equipment_name = name.strong.a.find_all('span')[2].text.strip()
            test_soup = BeautifulSoup(urlopen(test_link), 'lxml')
            if not test_soup.find('img', attrs={'alt': '바로구매하기'}).find_parent(
                'a', class_='displaynone'):
                rf.write('%s\t%s\tYES\n' % (equipment_name, test_link))
                img_src = 'http:' + test_soup.find('img', class_='BigImage'
                    ).get('src')
                img_name = equipment_name.replace('.', '_').replace('?', '_'
                    ).replace('!', '_').replace('/', '_') + '.jpg'
                urlretrieve(img_src, os.path.join(RESULT_PATH, img_name))
            else:
                rf.write('%s\t%s\tNO\n' % (equipment_name, test_link))
            loop_cnt += 1

import os
from urllib.request import urlopen, urlretrieve
from bs4 import BeautifulSoup

RESULT_PATH = os.path.join('.', 'yes_imgs')
if not os.path.exists(RESULT_PATH):
    os.mkdir(RESULT_PATH)

with open('./result.tsv', 'w') as rf:
    for page in range(1, 20):
        print('page: %d' % page)
        URL = 'http://www.the35mm.com/product/list.html?cate_no=24&sort_method=3&page=%d' % page

        soup = BeautifulSoup(urlopen(URL), 'lxml')
        names = soup.find_all('p', class_='name')
        total_size = len(names)
        loop_cnt = 1
        for name in names:
            print('%d/%d' % (loop_cnt, total_size))
            test_link ='http://www.the35mm.com' + name.find('a').get('href')
            equipment_name = name.strong.a.find_all('span')[2].text.strip()
            test_soup = BeautifulSoup(urlopen(test_link), 'lxml')
            if not test_soup.find('img', attrs={'alt': '바로구매하기'}).find_parent('a', class_='displaynone'):
                rf.write('%s\t%s\tYES\n' % (equipment_name, test_link))
                img_src = 'http:' + test_soup.find('img', class_='BigImage').get('src')
                img_name = equipment_name.replace('.', '_').replace('?', '_').replace('!', '_').replace('/', '_') + '.jpg'
                urlretrieve(img_src, os.path.join(RESULT_PATH, img_name))
            else:
                rf.write('%s\t%s\tNO\n' % (equipment_name, test_link))
            loop_cnt += 1
