Your Name %!s(int64=3) %!d(string=hai) anos
pai
achega
b9dcc3f86b
Modificáronse 1 ficheiros con 16 adicións e 0 borrados
  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)