This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
def get_price(): | |
url = r'''https://www.amazon.com/Xiaomi-10000mAh-External-Portable-Smartphone/dp/B01CU0Z3UE/ref=s9u_simh_gw_i2?_encoding=UTF8&fpl=fresh&pf_rd_m=ATVPDKIKX0DER&pf_rd_s=&pf_rd_r=3SPPSMHRQEVAYS1KWZBD&pf_rd_t=36701&pf_rd_p=1cded295-23b4-40b1-8da6-7c1c9eb81d33&pf_rd_i=desktop''' | |
res = requests.get(url) | |
soup = BeautifulSoup(res.text) | |
price_span = soup.find("span", id="priceblock_ourprice") | |
print price_span.text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from lxml import html | |
import requests | |
page = requests.get('http://gall.dcinside.com/board/lists/?id=kimnamgil&page=') | |
dc_content = unicode(page.text).encode('utf-8') | |
tree = html.fromstring(dc_content) | |
#This will create a list of buyers: | |
titles = tree.xpath('//td[@class="t_subject"]/a/text()') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
craw_url = '''http://www.ticketmonster.co.kr/deal/515095746''' | |
page = requests.get(craw_url) | |
product_contents = page.text | |
soup = BeautifulSoup(product_contents) | |
price_tag = soup.find('strong', {'class':'now_price'}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import requests | |
from bs4 import BeautifulSoup | |
def search_daum_dic(query_keyword): | |
dic_url = """http://dic.daum.net/search.do?q={0}""" | |
r = requests.get(dic_url.format(query_keyword)) | |
soup = BeautifulSoup(r.text, "html.parser") | |
result_means = soup.find_all(attrs={'class':'list_search'}) |
NewerOlder