Skip to content

Commit 9f01677

Browse files
committed
패키지 메니저 예제 추가
1 parent 5c83d40 commit 9f01677

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

‎Package_Manager/1.py‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import requests
2+
from bs4 import BeautifulSoup
3+
r = requests.get('https://codingeverybody.github.io/scraping_sample/1.html')
4+
soup = BeautifulSoup(r.text, 'html.parser')
5+
print('Title : '+soup.title.string)
6+
articles = soup.findAll('div', {'class' : 'em'})
7+
print('Article : '+articles[0].text)
8+
9+
print("====================")
10+
11+
r = requests.get('https://codingeverybody.github.io/scraping_sample/2.html')
12+
soup = BeautifulSoup(r.text, 'html.parser')
13+
print('Title : '+soup.title.string)
14+
articles = soup.findAll('div', {'class' : 'strong'})
15+
print('Article : '+articles[0].text)

‎Package_Manager/1.rb‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
require "http"
2+
require 'nokogiri'
3+
4+
html = HTTP.get('https://codingeverybody.github.io/scraping_sample/1.html').to_s
5+
page = Nokogiri::HTML(html)
6+
puts "Title : "+page.css('title')[0].text
7+
puts "Article : "+page.css('div.em')[0].text
8+
9+
puts "===================="
10+
11+
html = HTTP.get('https://codingeverybody.github.io/scraping_sample/2.html').to_s
12+
page = Nokogiri::HTML(html)
13+
puts "Title : "+page.css('title')[0].text
14+
puts "Article : "+page.css('div.strong')[0].text

0 commit comments

Comments
 (0)