import codecs
import random
import os
import time
fpath=__file__
fpath=fpath.replace('curl_click.py','urls.csv')
print(fpath)

lst=[]
fr=codecs.open(fpath,'r','utf-8')
lines=fr.readlines()
for l in lines:
    elmts=l.split(',')
    lst.append('https://www.hhh.com.tw'+elmts[0])
fr.close()

#for i in range(20):
while True:
    l=random.choice(lst)
#    os.system('docker run --rm curlimages/curl:7.79.1 -L -v '+l)
#    os.system('curl -Lx http://127.0.0.1:8118 '+l)
    os.system('phantomjs '+l)


#    os.system('curl '+l)
#    time.sleep(1)
print(l)