zooeytsai 3 سال پیش
والد
کامیت
b53960d4bc
1فایلهای تغییر یافته به همراه7 افزوده شده و 6 حذف شده
  1. 7 6
      ig_tags/ig_selenium.py

+ 7 - 6
ig_tags/ig_selenium.py

@@ -16,8 +16,8 @@ import pymysql
 pymysql.install_as_MySQLdb()
 
 
-account = ['chenlinrain']
-pd = ['weareyoung12']
+account = ['liftwotsai','chenlinrain','enjoylisteningswift']
+pd = ['obl787iviate634','weareyoung12']
 
 path = '/Users/zooeytsai/Downloads/chromedriver'
 sbaccount = account[2]
@@ -46,7 +46,8 @@ def download_post():
         jar.set(i['name'], i['value'])
     driver.get(url)
     time.sleep(3)
-    number_of_posts = 100
+    limit_of_posts = 100
+    c = 0
     wait = WebDriverWait(driver, 10)
     last_height = driver.execute_script(
         "window.scrollTo(0, document.body.scrollHeight);var scrolldown=document.body.scrollHeight;return scrolldown;")
@@ -60,10 +61,10 @@ def download_post():
         time.sleep(3)
         new_height = driver.execute_script("return document.body.scrollHeight")
         driver.implicitly_wait(3)
-        number_of_posts+=1
-        if len(link)>number_of_posts:
+        c+=1
+        if c > limit_of_posts:
             time.sleep(randint(180,300))
-            number_of_posts == 0
+            print('中場休息')
         if len(link)>10000:
             break