37 lines
708 B
Python
37 lines
708 B
Python
import requests, bs4, urllib, sys, re, math
|
|
|
|
term = str(sys.argv[1])
|
|
query = urllib.parse.quote_plus(term)
|
|
|
|
url = 'https://kr.misumi-ec.com/vona2/result/'
|
|
url2 = '?Keyword=' + query + '&isReSearch=1'
|
|
url = url + url2
|
|
|
|
resp = requests.get(url)
|
|
resp.raise_for_status()
|
|
resp.encoding='UTF-8'
|
|
|
|
html = resp.text
|
|
|
|
bs = bs4.BeautifulSoup(html, 'html.parser')
|
|
|
|
_list = bs.select('ul.m-linkList--keyword li a')
|
|
|
|
if len(_list) == 0 :
|
|
print(
|
|
"misumi" + "\t" +
|
|
term + "\t" +
|
|
"\t" +
|
|
str(len(_list)) + "\t" +
|
|
str(0)
|
|
)
|
|
else :
|
|
for i in range(len(_list)) :
|
|
aff_terms = _list[i].getText().strip()
|
|
print(
|
|
"misumi" + "\t" +
|
|
term + "\t" +
|
|
aff_terms + "\t" +
|
|
str(len(_list)) + "\t" +
|
|
str(i+1)
|
|
) |