Explorar o código

fix for layout change on 21-07-28

Mike L %!s(int64=3) %!d(string=hai) anos
pai
achega
191afb6704
Modificáronse 2 ficheiros con 3 adicións e 2 borrados
  1. 1 1
      dist/webshot.js
  2. 2 1
      src/webshot.ts

+ 1 - 1
dist/webshot.js

@@ -96,7 +96,7 @@ class Webshot extends CallableInstance {
                             });
                         }, 250);
                     }))
-                        .then(() => page.waitForSelector('xpath=//section/*/*/div[.//article/*/*/*/*/*[@role="group"]]', { timeout: getTimeout() }))
+                        .then(() => page.waitForSelector('xpath=//section/*/*/div[.//article[not(.//time)]]', { timeout: getTimeout() }))
                         .then(handle => handle.$$('xpath=..//a[contains(@href,"content_you_see")]/../../..//*[@role="button"]')
                         .then(sensitiveToggles => {
                         const count = sensitiveToggles.length;

+ 2 - 1
src/webshot.ts

@@ -123,7 +123,8 @@ class Webshot extends CallableInstance<[Tweets, (...args) => void, number], Prom
                 });
               }, 250);
             }))
-            .then(() => page.waitForSelector('xpath=//section/*/*/div[.//article/*/*/*/*/*[@role="group"]]', {timeout: getTimeout()}))
+            // find main tweet
+            .then(() => page.waitForSelector('xpath=//section/*/*/div[.//article[not(.//time)]]', {timeout: getTimeout()}))
             // toggle visibility of sensitive tweets
             .then(handle => handle.$$('xpath=..//a[contains(@href,"content_you_see")]/../../..//*[@role="button"]')
               .then(sensitiveToggles => {