Jason %!s(int64=2) %!d(string=hai) anos
pai
achega
1c89be8beb
Modificáronse 1 ficheiros con 45 adicións e 0 borrados
  1. 45 0
      website_clickjobs/type-GD/yours.py

+ 45 - 0
website_clickjobs/type-GD/yours.py

@@ -0,0 +1,45 @@
+from _clickjob import *
+
+db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/seo?charset=utf8mb4')
+
+def reset():
+    ds=db.query('select * from seo.seo_articles where cust="優思整合顧問"')
+    #TAG ABOVE AND UNTAG BELOW FOR DEBUG
+    #ds=hhhdb.query('select * from seo.seo_articles where cust=')
+    data=[]
+    for i in ds:
+        for j in range(i['weight']):
+            data.append([i['kw'].replace('\xa0',' '),i['cust'].replace('\xa0',' '),i['url']])
+    random.shuffle(data)
+    return data
+
+#data = getdata()
+
+runcount=0
+while True:
+    try:
+        print("Gathering data...")
+        data = reset()
+        print('Data collected')
+        dataok = 1
+    except:
+        dataok = 0
+        print("Error while collecting data.")
+    if dataok == 1:
+        for i in range(10):
+            print("Run " + str(runcount+1))
+            target = random.choice(data) # START HERE
+            target_kw = target[0]
+            cust = target[1]
+            target_url = target[2]
+            print(target_kw)
+            print(cust)
+            print(target_url)
+            statuscode = execute(target_url, cust, target_kw)
+            if statuscode == 444:
+                print("Completed ", runcount, " times before being caught")
+                time.sleep(300)
+            else:
+                runcount+=1
+    else:
+        time.sleep(60)