Your Name 3 年之前
父節點
當前提交
b9dcc3f86b
共有 1 個文件被更改,包括 16 次插入0 次删除
  1. 16 0
      hhh/SEO/test_backlink.py

+ 16 - 0
hhh/SEO/test_backlink.py

@@ -0,0 +1,16 @@
+# Get the first 20 hits for: "Breaking Code" WordPress blog
+from googlesearch import search
+import dataset
+import time
+
+db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/hhh?charset=utf8mb4')
+table=db['backlinks']
+#for url in search('link:https://www.searchome.net/ -site:searchome.net', num_results=100):
+#for url in search('link:https://www.searchome.net/ -site:searchome.net', 10):
+for url in search('link:https://www.searchome.net/ -site:searchome.net',start=60,stop=1000):
+    try:
+        table.insert({'url':url})
+        time.sleep(5)
+    except:
+        print('except')
+    print(url)