import urllib2
import re
from bs4 import BeautifulSoup
url="
http://www.exporivaschuh.it/catalogue/15ES2/search.html"
soup = BeautifulSoup(urllib2.urlopen(url).read())
script = soup.findAll('script')[0].string
p1 = re.compile('new e \(.*\)')
arrEs = p1.findall(script)
f = open('companysofchina.csv', 'w')
for e in arrEs:
e = e.replace('new e (','').replace(')', '')
arrItems = eval('[' + e + ']')
if arrItems[3] == 'CN':
company = arrItems[0]
tel = arrItems[9]
email = arrItems[10]
f.write(company + ',' + tel + ',' + email + '\n')
f.close()