# -*- coding: utf-8 -*-

import sys  
reload(sys)  
sys.setdefaultencoding('utf8')

import requests
from bs4 import BeautifulSoup
import json
import os
import itertools, string

from openpyxl import Workbook, load_workbook
import xlwt, xlrd

wb = Workbook()
excel_document = load_workbook('new.xlsx')
sheet = excel_document.get_sheet_by_name('sheet1')

multiple_cells = sheet['A44083':'A44268']
arr = []
for row in multiple_cells:
    for cell in row:
        tmp = cell.value
        arr.append(tmp)
yeah = map(lambda a: str(a), arr)

BASE_DIR = os.path.dirname(os.path.abspath(__file__))

base_url = 'https://coding.edaily.co.kr/member/regist_ok.php?seq={}'

for n in range(99999):
        req = requests.get(base_url.format(yeah[n]))
        html = req.text
        soup = BeautifulSoup(html, 'html.parser')
    
        my_titles = soup.select(
            '.info > p > strong'
        )

        data = {}

        for title in my_titles:
            text = title.text
            text = text.replace(" : ", "")

            contents = title.next_sibling
            contents = contents.replace(" ", "")

            data[text] = contents

        f = open(os.path.join(BASE_DIR, 'result.json'), 'a')
        json.dump(data, f, ensure_ascii=False)
        f.write('\n')
# -*- coding: utf-8 -*-

import sys  
reload(sys)  
sys.setdefaultencoding('utf8')

import requests
from bs4 import BeautifulSoup
import json
import os
import itertools, string

from openpyxl import Workbook, load_workbook
import xlwt, xlrd

wb = Workbook()
excel_document = load_workbook('new.xlsx')
sheet = excel_document.get_sheet_by_name('sheet1')

multiple_cells = sheet['A44083':'A44268']
arr = []
for row in multiple_cells:
    for cell in row:
        tmp = cell.value
        arr.append(tmp)
yeah = map(lambda a: str(a), arr)

BASE_DIR = os.path.dirname(os.path.abspath(__file__))

base_url = 'https://coding.edaily.co.kr/member/regist_ok.php?seq={}'

for n in range(99999):
        req = requests.get(base_url.format(yeah[n]))
        html = req.text
        soup = BeautifulSoup(html, 'html.parser')
    
        my_titles = soup.select(
            '.info > p > strong'
        )

        data = {}

        for title in my_titles:
            text = title.text
            text = text.replace(" : ", "")

            contents = title.next_sibling
            contents = contents.replace(" ", "")

            data[text] = contents

        f = open(os.path.join(BASE_DIR, 'result.json'), 'a')
        json.dump(data, f, ensure_ascii=False)
        f.write('\n')
# -*- coding: utf-8 -*-