Browse Source

fix overselecting css selectors

Mike L 3 years ago
parent
commit
480e785181
2 changed files with 2 additions and 2 deletions
  1. 1 1
      dist/webshot.js
  2. 1 1
      src/webshot.ts

+ 1 - 1
dist/webshot.js

@@ -80,7 +80,7 @@ class Webshot extends CallableInstance {
                     })
                         .then(() => page.goto(url, { waitUntil: 'load', timeout: getTimeout() }))
                         .then(() => page.addStyleTag({
-                        content: 'header{display:none!important}div[role=\'button\'],[data-testid="tweet"]+*>[class*=" "]+*{display:none}',
+                        content: 'header{display:none!important}[data-testid="caret"],[data-testid="tweet"]+*>:nth-last-child(-n+2){display:none}',
                     }))
                         .then(() => page.addStyleTag({
                         content: '*{font-family:-apple-system,".Helvetica Neue DeskInterface",Hiragino Sans,Hiragino Sans GB,sans-serif!important}',

+ 1 - 1
src/webshot.ts

@@ -103,7 +103,7 @@ class Webshot extends CallableInstance<[Tweets, (...args) => void, number], Prom
             .then(() => page.goto(url, {waitUntil: 'load', timeout: getTimeout()}))
             // hide header, "more options" button, like and retweet count
             .then(() => page.addStyleTag({
-              content: 'header{display:none!important}div[role=\'button\'],[data-testid="tweet"]+*>[class*=" "]+*{display:none}',
+              content: 'header{display:none!important}[data-testid="caret"],[data-testid="tweet"]+*>:nth-last-child(-n+2){display:none}',
             }))
             .then(() => page.addStyleTag({
               content: '*{font-family:-apple-system,".Helvetica Neue DeskInterface",Hiragino Sans,Hiragino Sans GB,sans-serif!important}',