term_gsearch.py 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. import gsearch_general
  2. import sys
  3. import dataset
  4. import datetime
  5. db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
  6. db_local = dataset.connect('mysql://root:jondae350@localhost:3306/db?charset=utf8mb4')
  7. table=db_local['test']
  8. driver=gsearch_general.restart_browser()
  9. #idx=gsearch_general.process_query(driver,'團購 email 牛',number_results=100,language_code='zh-TW')
  10. #idx=gsearch_general.process_query(driver,'site:facebook.com pages inurl:about 其他聯絡資訊 購',number_results=100,language_code='zh-TW')
  11. #idx=gsearch_general.process_query(driver,'聯絡我們 mailto 批發',number_results=100,language_code='zh-TW')
  12. #idx=gsearch_general.process_query(driver,'聯絡我們 mailto 蛋捲',number_results=100,language_code='zh-TW')
  13. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 肉乾',number_results=100,language_code='zh-TW')
  14. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 寵物',number_results=100,language_code='zh-TW')
  15. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 雞精',number_results=100,language_code='zh-TW')
  16. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 設計',number_results=100,language_code='zh-TW')
  17. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 民宿',number_results=100,language_code='zh-TW')
  18. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 面膜',number_results=100,language_code='zh-TW')
  19. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 杏仁',number_results=100,language_code='zh-TW')
  20. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 戶外',number_results=100,language_code='zh-TW')
  21. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 嬰兒',number_results=100,language_code='zh-TW')
  22. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 燈泡',number_results=100,language_code='zh-TW')
  23. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 焦糖',number_results=100,language_code='zh-TW')
  24. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 芝麻',number_results=100,language_code='zh-TW')
  25. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 網購',number_results=100,language_code='zh-TW')
  26. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 膠囊',number_results=100,language_code='zh-TW')
  27. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 實業',number_results=100,language_code='zh-TW')
  28. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 工作室',number_results=100,language_code='zh-TW')
  29. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 企業社',number_results=100,language_code='zh-TW')
  30. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 電商',number_results=100,language_code='zh-TW')
  31. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 社會企業',number_results=100,language_code='zh-TW')
  32. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 商城',number_results=100,language_code='zh-TW')
  33. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 網頁 工作室',number_results=100,language_code='zh-TW')
  34. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 媒合 平台',number_results=100,language_code='zh-TW')
  35. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 跨境',number_results=100,language_code='zh-TW')
  36. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 雜誌',number_results=100,language_code='zh-TW')
  37. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 業配',number_results=100,language_code='zh-TW')
  38. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 油壓',number_results=100,language_code='zh-TW')
  39. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 工業',number_results=100,language_code='zh-TW')
  40. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 餐廳',number_results=100,language_code='zh-TW')
  41. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 宅配',number_results=100,language_code='zh-TW')
  42. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 外套',number_results=100,language_code='zh-TW')
  43. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 班服',number_results=100,language_code='zh-TW')
  44. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 攝影',number_results=100,language_code='zh-TW')
  45. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 牧場',number_results=100,language_code='zh-TW')
  46. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 釣蝦',number_results=100,language_code='zh-TW')
  47. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 新竹',number_results=100,language_code='zh-TW')
  48. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 竹北',number_results=100,language_code='zh-TW')
  49. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 竹東',number_results=100,language_code='zh-TW')
  50. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 竹南',number_results=100,language_code='zh-TW')
  51. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 幼兒',number_results=100,language_code='zh-TW')
  52. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 樂器',number_results=100,language_code='zh-TW')
  53. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 創意',number_results=100,language_code='zh-TW')
  54. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 出口',number_results=100,language_code='zh-TW')
  55. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 器材',number_results=100,language_code='zh-TW')
  56. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 零件',number_results=100,language_code='zh-TW')
  57. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 零組件',number_results=100,language_code='zh-TW')
  58. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 精密',number_results=100,language_code='zh-TW')
  59. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 中藥',number_results=100,language_code='zh-TW')
  60. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 聯誼會',number_results=100,language_code='zh-TW')
  61. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 建築',number_results=100,language_code='zh-TW')
  62. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 代銷',number_results=100,language_code='zh-TW')
  63. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 生前',number_results=100,language_code='zh-TW')
  64. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 保經',number_results=100,language_code='zh-TW')
  65. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 人本',number_results=100,language_code='zh-TW')
  66. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 生命',number_results=100,language_code='zh-TW')
  67. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 醫美',number_results=100,language_code='zh-TW')
  68. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 幹細胞',number_results=100,language_code='zh-TW')
  69. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 減重',number_results=100,language_code='zh-TW')
  70. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 醫材',number_results=100,language_code='zh-TW')
  71. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 婚紗',number_results=100,language_code='zh-TW')
  72. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 月子',number_results=100,language_code='zh-TW')
  73. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 製藥',number_results=100,language_code='zh-TW')
  74. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 貿易',number_results=100,language_code='zh-TW')
  75. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 油品',number_results=100,language_code='zh-TW')
  76. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 建材',number_results=100,language_code='zh-TW')
  77. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 清潔',number_results=100,language_code='zh-TW')
  78. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 化學',number_results=100,language_code='zh-TW')
  79. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 檢驗',number_results=100,language_code='zh-TW')
  80. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 蛋糕',number_results=100,language_code='zh-TW')
  81. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 旅館',number_results=100,language_code='zh-TW')
  82. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 回收',number_results=100,language_code='zh-TW')
  83. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 高爾夫',number_results=100,language_code='zh-TW')
  84. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 雷射切割',number_results=100,language_code='zh-TW')
  85. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 飲茶',number_results=100,language_code='zh-TW')
  86. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 連鎖',number_results=100,language_code='zh-TW')
  87. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 加盟',number_results=100,language_code='zh-TW')
  88. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 早午餐',number_results=100,language_code='zh-TW')
  89. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 藥局',number_results=100,language_code='zh-TW')
  90. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 廣告',number_results=100,language_code='zh-TW')
  91. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 代表',number_results=100,language_code='zh-TW')
  92. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 當鋪',number_results=100,language_code='zh-TW')
  93. #idx=gsearch_general.process_query(driver,'聯絡我們 after:2021-10-01 before:2021-11-01 數位',number_results=100,language_code='zh-TW')
  94. #idx=gsearch_general.process_query(driver,'site:facebook.com inurl:about 聯絡資訊 開幕',number_results=100,language_code='zh-TW')
  95. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 廣告投放',number_results=100,language_code='zh-TW')
  96. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 行銷',number_results=100,language_code='zh-TW')
  97. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 看板',number_results=100,language_code='zh-TW')
  98. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 管理 顧問',number_results=100,language_code='zh-TW')
  99. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 派報',number_results=100,language_code='zh-TW')
  100. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 書局',number_results=100,language_code='zh-TW')
  101. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 商 協會',number_results=100,language_code='zh-TW')
  102. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 車行',number_results=100,language_code='zh-TW')
  103. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 預約',number_results=100,language_code='zh-TW')
  104. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 美甲',number_results=100,language_code='zh-TW')
  105. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 髮型',number_results=100,language_code='zh-TW')
  106. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 軟體',number_results=100,language_code='zh-TW')
  107. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 肥料',number_results=100,language_code='zh-TW')
  108. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 堅果',number_results=100,language_code='zh-TW')
  109. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 果乾',number_results=100,language_code='zh-TW')
  110. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 安親',number_results=100,language_code='zh-TW')
  111. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 運輸',number_results=100,language_code='zh-TW')
  112. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 工程顧問',number_results=100,language_code='zh-TW')
  113. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 園藝',number_results=100,language_code='zh-TW')
  114. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 日式料理',number_results=100,language_code='zh-TW')
  115. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 泰式料理',number_results=100,language_code='zh-TW')
  116. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 法式料理',number_results=100,language_code='zh-TW')
  117. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 清真料理',number_results=100,language_code='zh-TW')
  118. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 烘焙',number_results=100,language_code='zh-TW')
  119. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 磁磚',number_results=100,language_code='zh-TW')
  120. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 命理',number_results=100,language_code='zh-TW')
  121. #idx=gsearch_general.process_query(driver,'聯絡我們 mail 改運',number_results=100,language_code='zh-TW')
  122. # idx=gsearch_general.process_query(driver,'聯絡我們 mail 風水',number_results=100,language_code='zh-TW')
  123. <<<<<<< HEAD
  124. idx=gsearch_general.process_query(driver,'聯絡我們 mail 公益',number_results=100,language_code='zh-TW')
  125. =======
  126. # idx=gsearch_general.process_query(driver,'聯絡我們 mail 公益',number_results=100,language_code='zh-TW')
  127. idx=gsearch_general.process_query(driver,'聯絡我們 區塊鏈',number_results=100,language_code='zh-TW')
  128. >>>>>>> 604b4f0737fe7f055de28e84a0a4697a346701cf
  129. print(idx)
  130. for x in idx:
  131. x['dt']=datetime.datetime.now()
  132. <<<<<<< HEAD
  133. =======
  134. x['tag']='區塊鏈2'
  135. print(x)
  136. >>>>>>> 604b4f0737fe7f055de28e84a0a4697a346701cf
  137. table.insert(x)
  138. if idx==None:
  139. print(driver.page_source)
  140. if '我們的系統偵測到您的電腦網路送出的流量有異常情況' in driver.page_source:
  141. print('baned.....')
  142. sys.exit()