<jupyter_start><jupyter_text>순차적으로 하기<jupyter_code>import requests<jupyter_output><empty_output><jupyter_text>http://media.daum.net/economic/<jupyter_code>path='http://media.daum.net/economic/'
req = requests.get(path)
req.status_code
from bs4 import BeautifulSoup as bs
soup=bs(req.content,'html.parser')
type(soup)
result=soup.select('div > strong.tit_thumb > a[href].link_txt')
type(result)
result[0]
tag=result[0]
tag.text
tag['href']<jupyter_output><empty_output><jupyter_text>[    [title,link],    [title01,link01],    [title02,link02],    ....]<jupyter_code>a=[]
for tag in result:
    #print(tag.text.strip(), tag['href'])
    title=tag.text.strip()
    link=tag['href'].strip()
    content=[title,link]
    a.append(content)
a
len(a)
import pandas as pd
data1=pd.DataFrame(a, columns=['Title', 'Link'])
data1
data1.to_excel('./saves/economic01.xls',index=False)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18, 'fraction_numerical': 0.017777777777777778, 'mean_word_length': 6.635593220338983, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '100779', 'license': 'Apache-2.0', 'n_tokens_mistral': 371, 'n_tokens_neox': 363, 'n_words': 47, 'path': 'daum.net_economic_scraping_bs4.ipynb', 'repo_name': 'hakdj/test_webscraping', 'size': '900'}