imp_contentgap.py 1011 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. from selenium import webdriver
  2. from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
  3. import time
  4. import os
  5. import datetime
  6. import urllib.parse
  7. from selenium.webdriver.support.ui import WebDriverWait
  8. from selenium.webdriver.common.by import By
  9. from selenium.webdriver.support import expected_conditions as EC
  10. import codecs
  11. import random
  12. from bs4 import BeautifulSoup
  13. import requests
  14. import time
  15. import rpyc
  16. import sys
  17. import docker
  18. import googlesearch
  19. import codecs
  20. import sys
  21. import time
  22. import dataset
  23. import os
  24. db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/hhh?charset=utf8mb4')
  25. table=db['contentgap_terms']
  26. curdir=os.path.realpath('.')
  27. #fr=codecs.open(curdir+os.sep+'contentgap.txt','r','utf-8')
  28. #fr=codecs.open(curdir+os.sep+'hhh\\seo\\contentgap.txt','r','utf-8')
  29. fr=codecs.open('C:\\gitlab\\kw_tools\\kw_tools\\hhh\\SEO\\contentgap.txt','r','utf-8')
  30. lines=fr.readlines()
  31. lst=[]
  32. for l in lines:
  33. term=l.replace('\n','')
  34. table.insert({'term':term})