from seleniumwire import webdriver  # Import from seleniumwire
import time
import requests
import sys
import dataset
import os
fname=os.path.abspath(__file__)
fname=fname.replace('hhh_404_manager.py','hhh_404.py')


db = dataset.connect('mysql://hhh7796hhh:lYmWsu^ujcA1@hhh-v57.cmab1ctkglka.ap-northeast-2.rds.amazonaws.com:3306/xoops?charset=utf8mb4')

cursor=db.query('SELECT hcolumn_id FROM xoops._hcolumn where onoff>0 order by rand()  limit 1;')
for c in cursor:
    print(c['hcolumn_id'])
    os.system('python3 hhh_404.py https://hhh.com.tw/columns/detail/'+str(c['hcolumn_id'])+'/')
    os.system('python3 hhh_404.py https://www.hhh.com.tw/')
    os.system('python3 hhh_404.py https://m.hhh.com.tw/hhh-home-mb/index.html')