|
@@ -154,10 +154,11 @@ class Webshot extends CallableInstance<[Tweets, (...args) => void, number], Prom
|
|
|
}
|
|
|
} catch {/* handle errors like none-found cases */}
|
|
|
document.documentElement.scrollTop = 0;
|
|
|
- });
|
|
|
+ }).then(() => handle);
|
|
|
})
|
|
|
- .then(() => page.evaluate(() => {
|
|
|
- const cardImg = document.querySelector('div[data-testid^="card.layout"][data-testid$=".media"] img');
|
|
|
+ // scrape card image from main tweet
|
|
|
+ .then(handle => handle.evaluate(div => {
|
|
|
+ const cardImg = div.querySelector('div[data-testid^="card.layout"][data-testid$=".media"] img');
|
|
|
if (typeof cardImg?.getAttribute('src') === 'string') {
|
|
|
const match = /^(.*\/card_img\/(\d+)\/.+\?format=.*)&name=/.exec(cardImg?.getAttribute('src'));
|
|
|
if (match) {
|