Skip to content
This repository was archived by the owner on Aug 27, 2025. It is now read-only.

Commit 295e66d

Browse files
committed
fix: upload only self's media
Unable to filter videos currently :(
1 parent 69ea27b commit 295e66d

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/content-script/hooks/twitter.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class TwitterHook {
5454

5555
const attachmentUrls = Array.from(
5656
document.querySelectorAll(
57-
'[data-testid="attachments"] img, [data-testid="attachments"] source',
57+
'[data-testid="attachments"] div[aria-label="Media"] img, [data-testid="attachments"] div[aria-label="Media"] source',
5858
),
5959
).map((attachment) => {
6060
return (<HTMLImageElement | HTMLSourceElement>attachment).src;
@@ -274,9 +274,9 @@ class TwitterHook {
274274
// Get tweet data
275275
const tweetText = tweet.querySelector('[data-testid="tweetText"]')?.textContent || '';
276276
const tweetMedia = [
277-
...Array.from(tweet.querySelectorAll('[data-testid="tweetPhoto"] img')).map((img) =>
278-
img.getAttribute('src'),
279-
),
277+
...Array.from(
278+
tweet.querySelectorAll(`a[href^="/${username}/status/"] [data-testid="tweetPhoto"] img`),
279+
).map((img) => img.getAttribute('src')),
280280
...Array.from(tweet.querySelectorAll('[data-testid="videoPlayer"] video')).map((video) =>
281281
video.getAttribute('poster'),
282282
),

0 commit comments

Comments
 (0)