bnew

Veteran
Joined
Nov 1, 2015
Messages
57,350
Reputation
8,496
Daps
160,046
adjusted the output. this only saves tweets from the parents username aka tweet author. this also extracts video urls from nitter instances that support direct video links.


This bookmarklet is designed to run on a Nitter instance, which is an alternative front-end for Twitter. Here’s what it does in layman's terms:
  1. Collect Tweets: It scans the current page for tweets and logs how many tweets it finds.
  2. Identify Username: It identifies the username of the user whose tweets are being collected.
  3. Extract Tweet Content:
    • For each tweet, it extracts the text content, including any quoted tweets and media (images and videos).
    • It cleans up the text by removing HTML tags and formatting links and media URLs.
  4. Collect Thread Continuation URLs: It collects URLs of continued threads if any.
  5. Format Text: It formats all extracted tweet texts into a single string with spoilers for full text and large images.
  6. Copy to Clipboard: It copies the formatted text to your clipboard.
  7. Display Notification: It shows a temporary notification that the tweets have been copied.



Here's an example of what might be copied to your clipboard:
Code:
https://twitter.com/username/status/1234567890
[SPOILER="thread continued"]
https://twitter.com/username/status/1234567891
https://twitter.com/username/status/1234567892
[/SPOILER]

[SPOILER="full text & large images"]

1/3
This is the first tweet text.
[img]https://pbs.twimg.com/media/image.jpg[/img]

2/3
This is the second tweet text with a quoted tweet:
[Quoted tweet]
Quoted text here
[U][URL]https://twitter.com/otheruser/status/0987654321[/URL][/U]

3/3
This is the third tweet text with a video:
[U][URL]https://video.twimg.com/ext_tw_video/1234567890.mp4[/URL][/U]

[COLOR=rgb(184, 49, 47)][B][SIZE=5]To post tweets in this format, more info here: [URL]https://www.thecoli.com/threads/tips-and-tricks-for-posting-the-coli-megathread.984734/post-52211196[/URL][/SIZE][/B][/COLOR]
[/SPOILER]
This output includes:
  • The original URL of the first tweet.
  • A spoiler containing URLs of continued threads.
  • A spoiler containing all formatted tweet texts along with any media links and quoted tweets.
 
Last edited:

bnew

Veteran
Joined
Nov 1, 2015
Messages
57,350
Reputation
8,496
Daps
160,046
different output ...
this also extracts video urls from nitter instances that support direct video links.

This bookmarklet is designed to collect and format tweets from a Nitter instance (a privacy-focused alternative to Twitter) in a specific way, making it easier to copy and share them. Here’s what it does in layman's terms:
  1. Collects Tweets: It scans the page for all visible tweets.
  2. Extracts Tweet Details: For each tweet, it extracts the tweet text, author, links, images, and videos.
  3. Formats the Content: It formats the extracted content into a structured text that includes:
    • The original URL of the tweet thread.
    • A list of URLs for continued threads.
    • The full text of each tweet with author names and any quoted tweets or media links.
  4. Copies to Clipboard: The formatted text is then copied to your clipboard.
  5. Displays Notification: A temporary notification appears on the screen indicating that the tweets have been copied.

updated code on 10/17/24 to support new subdomains used for hosting videos
Code:
(src && (
                src.startsWith('https://video') &&
                (src.includes('.twimg.com/ext_tw_video/') || src.includes('.twimg.com/amplify_video/'))
            ))




Here’s an example of what you might see after running this bookmarklet:
Code:
https://twitter.com/user/status/1234567890
[SPOILER="thread continued"]
https://twitter.com/user/status/1234567891
https://twitter.com/user/status/1234567892
[/SPOILER]

[SPOILER="full text & large images"]

1/3
@AuthorName
This is the first tweet text.
[U][URL]https://example.com/link[/URL][/U]

[img]https://pbs.twimg.com/media/image.jpg[/img]

2/3
@AuthorName
This is the second tweet text with a quoted tweet:
[Quoted tweet]
Quoted tweet text.
[U][URL]https://twitter.com/quoteduser/status/1234567893[/URL][/U]

3/3
@AuthorName
This is the third tweet text with a video link:
[U][URL]https://video.twimg.com/ext_tw_video/1234567894.mp4[/URL][/U]

[COLOR=rgb(184, 49, 47)][B][SIZE=5]To post tweets in this format, more info here: [URL]https://www.thecoli.com/threads/tips-and-tricks-for-posting-the-coli-megathread.984734/post-52211196[/URL][/SIZE][/B][/COLOR]
[/SPOILER]
This output includes links to continue reading threads, full text of each tweet along with any media or quoted content, and instructions on how to post such formatted content elsewhere.
 
Last edited:

bnew

Veteran
Joined
Nov 1, 2015
Messages
57,350
Reputation
8,496
Daps
160,046
thecoli has a limit of 20 {IMG} per post so I forked the code to create chains of the output per 20 {IMG}
it collects all tweets replies but only includes the tweet urls made by the tweet thread starter/OP.


Here are the changelogs for both versions of the bookmarklet

Changelog for Version 1: "nc6v2.4 (Restarting Numbering Sequence) Bookmarklet"​

Changes:​

  1. Image Count Threshold:
    • Added a check to process tweets when the image count reaches 20 or at the end of processing all tweets.
  2. URL Handling:
    • Replaced nitter.poast.org with twitter.com in URLs.
    • Removed trailing parameters from URLs containing /status/.
  3. Multiple Chains:
    • Implemented logic to handle multiple chains of tweets, each with its own [SPOILER="thread continued"] and [SPOILER="full text & large images"] sections.
    [SPOILER="thread continued"] [SPOILER="full text & large images"]
  4. Resetting Variables:
    • Reset userTweets, imgCounter, and tweetTexts after processing each chain.
  5. Notification and Copying:
    • Enhanced notification and copying logic to handle multiple chains correctly.
[SPOILER="thread continued"] [SPOILER="full text & large images"]

Layman's Term Summary:​

This version of the bookmarklet processes tweets in chunks based on the number of images found. It replaces nitter.poast.org with twitter.com in URLs, removes any extra parameters from status URLs, and handles multiple chains of tweets separately. Each chain starts its numbering from 1 again.

Changelog for Version 2: "nc6.v2.4.1 (Continuing Numbering Sequence) Bookmarklet"​

Changes:​

  1. Global Tweet Count:
    • Introduced a globalTweetCount variable to maintain a continuous numbering sequence across all chains.
  2. Image Count Threshold:
    • Same as Version 1, processes tweets when the image count reaches 20 or at the end of processing all tweets.
  3. URL Handling:
    • Same as Version 1, replaces nitter.poast.org with twitter.com and removes trailing parameters from URLs containing /status/.
  4. Multiple Chains with Continuous Indexing:
    • Ensures that the numbering sequence continues across multiple chains without resetting.
  5. Notification and Copying:
    • Enhanced notification and copying logic to reflect the continuous indexing.

Layman's Term Summary:​

This version of the bookmarklet also processes tweets in chunks based on the number of images found but maintains a continuous numbering sequence across all chains. It replaces nitter.poast.org with twitter.com in URLs, removes any extra parameters from status URLs, and ensures that each new chain continues the numbering from where the previous chain left off.

Detailed Changelog Comparison​

Common Changes:​

  • Image Count Threshold: Both versions process tweets when the image count reaches 20 or at the end of processing all tweets.
  • URL Handling: Both versions replace nitter.poast.org with twitter.com and remove trailing parameters from URLs containing /status/.
  • Multiple Chains: Both versions handle multiple chains of tweets with separate [SPOILER="thread continued"] and [SPOILER="full text & large images"] sections.
[SPOILER="thread continued"] [SPOILER="full text & large images"]

Unique Changes in Version 1:​

  • Resetting Variables: Resets userTweets, imgCounter, and tweetTexts after processing each chain, causing each chain to start its numbering from 1.
  • Notification and Copying Logic: Adjusted to handle multiple chains separately but with resetting indices.

Unique Changes in Version 2:​

  • Global Tweet Count: Introduced a globalTweetCount variable to maintain a continuous numbering sequence across all chains.
  • Continuous Indexing: Ensures that each new chain continues the numbering from where the previous chain left off.
This summary should help you understand the key differences and improvements in each version of the bookmarklet.

Version 1: "nc6v2.4 (Restarting Numbering Sequence) Bookmarklet"​





10/22/24 - this is was less buggy but it sometimes omitted the first url of a thread when in the first chain of the output


Code:
https://twitter.com/tify330/status/1453132871863083014
[SPOILER="thread continued"]
https://twitter.com/tify330/status/1453140805049364483
https://twitter.com/tify330/status/1453390190270091279
[/SPOILER]

[SPOILER="full text & large images"]
1/16
@tify330
United States District Court for the Western District of Washington

Tana Lin is now Washington state’s first Asian American federal judge and the first public defender to sit in this court.



[img]https://pbs.twimg.com/media/FCPi0GuX0AgYGUT.jpg[/img]

2/16
@tify330
United States Court of Appeals for the Second Circuit

Myrna Pérez will be will be the only Latina serving on the 2nd Circuit & the first since Justice Sotomayor went to SCOTUS 12 yrs.ago.

Myrna is Pres. Biden’s 20th confirmed Judge



[img]https://pbs.twimg.com/media/FClMqbWXIAMNUwn.jpg[/img]

...

16/16
@tify330
United States District Court for the District of Columbia

Jia M. Cobb is a former public defender and a civil rights attorney. She will be replacing Judge Emmet Sullivan who took senior status. Jia is only 41 year old and this is a lifetime appointment.



[img]https://pbs.twimg.com/media/FCqNo9CWYAo4QRY.jpg[/img]


[COLOR=rgb(184, 49, 47)][B][SIZE=5]To post tweets in this format, more info here: [URL]https://www.thecoli.com/threads/tips-and-tricks-for-posting-the-coli-megathread.984734/post-52211196[/URL][/SIZE][/B][/COLOR]
[/SPOILER]

[threads continued]


https://twitter.com/tify330/status/1408174718545432577
[SPOILER="thread continued"]
https://twitter.com/tify330/status/1455300200885542917
https://twitter.com/tify330/status/1455336185421783040
[/SPOILER]

[SPOILER="full text & large images"]
1/20
@tify330
United States District Court for the District of New Jersey

Judge Karen M. Williams has served as a U.S. Magistrate Judge since 2009 on this court. Judge William is now the 1st Senate-confirmed Black person to sit in the U.S. District courthouse in Camden, N.J.



[img]https://pbs.twimg.com/media/FCqQpVOX0AM-NWm.jpg[/img]

2/20
@tify330
United States District Court for the Eastern District of Virginia

Patricia Tolliver Giles served as an Assistant U.S. Attorney since 2003. This seat has been open for more than a year. This was her 3rd time being recommended to this court and now she is Judge Giles. Congrats!



...

20/20
@tify330
Another tweet with some text.



...

[COLOR=rgb(184, 49, 47)][B][SIZE=5]To post tweets in this format, more info here: [URL]https://www.thecoli.com/threads/tips-and-tricks-for-posting-the-coli-megathread.984734/post-52211196[/URL][/SIZE][/B][/COLOR]
[/SPOILER]

Version 2: "nc6.v2.4.1 (Continuing Numbering Sequence) Bookmarklet"​






10/22/24 - this is was less buggy but it sometimes omitted the first url of a thread when in the first chain of the output



Code:
https://twitter.com/tify330/status/1453132871863083014
[SPOILER="thread continued"]
https://twitter.com/tify330/status/1453140805049364483
https://twitter.com/tify330/status/1453390190270091279
[/SPOILER]

[SPOILER="full text & large images"]
1/34
@tify330
United States District Court for the Western District of Washington

Tana Lin is now Washington state’s first Asian American federal judge and the first public defender to sit in this court.



[img]https://pbs.twimg.com/media/FCPi0GuX0AgYGUT.jpg[/img]

2/34
@tify330
United States Court of Appeals for the Second Circuit

Myrna Pérez will be will be the only Latina serving on the 2nd Circuit & the first since Justice Sotomayor went to SCOTUS 12 yrs.ago.

Myrna is Pres. Biden’s 20th confirmed Judge



[img]https://pbs.twimg.com/media/FClMqbWXIAMNUwn.jpg[/img]

...

16/34
@tify330
United States District Court for the District of Columbia

Jia M. Cobb is a former public defender and a civil rights attorney. She will be replacing Judge Emmet Sullivan who took senior status. Jia is only 41 year old and this is a lifetime appointment.



[img]https://pbs.twimg.com/media/FCqNo9CWYAo4QRY.jpg[/img]


[COLOR=rgb(184, 49, 47)][B][SIZE=5]To post tweets in this format, more info here: [URL]https://www.thecoli.com/threads/tips-and-tricks-for-posting-the-coli-megathread.984734/post-52211196[/URL][/SIZE][/B][/COLOR]
[/SPOILER]

[threads continued]


https://twitter.com/tify330/status/1408174718545432577
[SPOILER="thread continued"]
https://twitter.com/tify330/status/1455300200885542917
https://twitter.com/tify330/status/1455336185421783040
[/SPOILER]

[SPOILER="full text & large images"]
17/34
@tify330
United States District Court for the District of New Jersey

Judge Karen M. Williams has served as a U.S. Magistrate Judge since 2009 on this court. Judge William is now the 1st Senate-confirmed Black person to sit in the U.S. District courthouse in Camden, N.J.



[img]https://pbs.twimg.com/media/FCqQpVOX0AM-NWm.jpg[/img]

18/34
@tify330
United States District Court for the Eastern District of Virginia

Patricia Tolliver Giles served as an Assistant U.S. Attorney since 2003. This seat has been open for more than a year. This was her 3rd time being recommended to this court and now she is Judge Giles. Congrats!



...

34/34
@tify330
Another tweet with some text.



...

[COLOR=rgb(184, 49, 47)][B][SIZE=5]To post tweets in this format, more info here: [URL]https://www.thecoli.com/threads/tips-and-tricks-for-posting-the-coli-megathread.984734/post-52211196[/URL][/SIZE][/B][/COLOR]
[/SPOILER]

Key Differences in Output:​

  • Version 1:
    • Each chain of tweets starts its numbering from 1.
    • Example: 1/16, 2/16, ..., 16/16 followed by another chain starting from 1/20.
  • Version 2:
    • The numbering sequence continues across multiple chains.
    • Example: 1/34, 2/34, ..., 16/34 followed by the next chain continuing from 17/34.
This illustrates how Version 2 maintains a continuous numbering sequence across all chains, while Version 1 resets the numbering for each new chain.
 
Last edited:

bnew

Veteran
Joined
Nov 1, 2015
Messages
57,350
Reputation
8,496
Daps
160,046
another nitter bookmarklet fork to support output that separates posts to 20 [IMG] max.
this collects only tweets urls and tweet text from the tweet thread author/OP .

Changelog for "Nc3v4.2"​

Version Nc3v4.2​

Release Date: [Insert Date]

New Features and Improvements​

  1. Grouping Tweets into Chains:
    • Introduced a new feature to group formatted tweets into "chains" or threads based on the number of images or when reaching the end of the list of tweets.
    • Each chain includes links to the original tweets, quoted tweets, images, and videos.
  2. Image Count Threshold:
    • Tweets are now grouped into chains if there are more than 20 images in the current set of tweets.
    • This helps in managing large sequences of tweets by breaking them down into smaller, more manageable chains.
  3. End-of-List Grouping:
    • If the script reaches the end of all available tweets, it will group any remaining formatted tweets into a chain.
    • Ensures that all tweets are included in a chain even if they do not meet the image count threshold.
  4. Enhanced Formatting:
    • Improved formatting for each chain to include spoiler sections for thread continuation URLs and full text with large images.
    • Added a link to a guide on how to post tweets in this format.
  5. Notification Update:
    • Updated the notification message to reflect both the number of chains and the total number of tweets processed.
    • Example: "Copied: X chains (Y tweets)"

Bug Fixes and Optimizations​

  1. Consistent URL Handling:
    • Ensured consistent handling of URLs by replacing nitter.poast.org with twitter.com across all links.
  2. Quoted Tweet Extraction:
    • Improved extraction logic for quoted tweets to ensure accurate capture and formatting.
  3. Video URL Handling:
    • Enhanced video URL extraction to handle different types of video sources correctly.
  4. HTML Element Conversion:
    • Optimized conversion of HTML elements like links and line breaks into plain text format.

Summary of "Nc3v4.2" in Layman's Terms​

The new code, "Nc3v4.2," is an enhanced version of your previous bookmarklet designed to scrape and format tweets from a Twitter page, specifically when using the Nitter frontend. Here’s what it does in simple terms:

Key Features​

  1. Identify Tweets:
    • It finds all the tweets on the current page.
  2. Filter by User:
    • It filters these tweets to only include those posted by a specific user.
  3. Extract Content:
    • For each tweet, it extracts the text, any quoted tweets, images, and videos.
    • It converts HTML elements into plain text format and adds links for images and videos.
  4. Group into Chains:
    • If there are more than 20 images in the current set of tweets or if it reaches the end of the list of tweets, it groups these formatted tweets into "chains" or threads.
    • Each chain includes links to the original tweets, quoted tweets, images, and videos.
  5. Copy to Clipboard:
    • Once all chains are formed, it combines them into one large string and copies this string to your clipboard.
    • A notification box appears briefly indicating that copying is complete.

Detailed Steps​

  • Identify Tweets and User:
    • The script finds all elements on the page that represent individual tweets (timeline-item) and ensures there are some.
    • It identifies the username of the user whose tweets are being scraped.
  • Extract Tweet Details:
    • For each tweet, it extracts:
      • The link to the tweet.
      • The text content of the tweet.
      • Any quoted tweets within this tweet.
      • Links to any images or videos in the tweet.
  • Format Tweet Text:
    • It converts HTML elements like links and line breaks into plain text format.
    • It adds quoted tweets and image/video URLs to the formatted text.
  • Group Tweets into Chains:
    • If there are more than 20 images or if it's at the end of all available tweets, it groups these formatted texts together as "chains" or threads.
    • Each chain includes a spoiler section for thread continuation URLs and another for full text with large images.
  • Copy Formatted Text to Clipboard:
    • Once all chains are formed, it combines them into one large string and copies this string to your clipboard.
    • A notification box appears briefly indicating that copying is complete.

updated 10/22/24




Code:
https://twitter.com/username/status/1234567890
[SPOILER="thread continued"]
https://twitter.com/username/status/1234567891
https://twitter.com/username/status/1234567892
[/SPOILER]

[SPOILER="full text & large images"]
1/3
@username
This is a sample tweet with some text.

[img]https://pbs.twimg.com/media/image.jpg[/img]

2/3
@username
This is another sample tweet with some more text.

[Quoted tweet]
This is a quoted tweet from someone else.
[U][URL]https://twitter.com/someoneelse/status/9876543210[/URL][/U]

3/3
@username
And this is yet another sample tweet with even more text.

[U][URL]https://video.twimg.com/ext_tw_video/...[/URL][/U]

[COLOR=rgb(184, 49, 47)][B][SIZE=5]To post tweets in this format, more info here: [URL]https://www.thecoli.com/threads/tips-and-tricks-for-posting-the-coli-megathread.984734/post-52211196[/URL][/SIZE][/B][/COLOR]
[/SPOILER]

[threads continued]

https://twitter.com/username/status/1234567893
[SPOILER="thread continued"]
https://twitter.com/username/status/1234567894
https://twitter.com/username/status/1234567895
[/SPOILER]

[SPOILER="full text & large images"]
4/6
@username
Another sample tweet...

5/6
@username
Yet another sample...

6/6
@username
Final sample...

[COLOR=rgb(184, 49, 47)][B][SIZE=5]To post tweets in this format, more info here: [URL]https://www.thecoli.com/threads/tips-and-tricks-for-posting-the-coli-megathread.984734/post-52211196[/URL][/SIZE][/B][/COLOR]
[/SPOILER]
 
Last edited:

bnew

Veteran
Joined
Nov 1, 2015
Messages
57,350
Reputation
8,496
Daps
160,046
another nitter bookmarklet fork to support output that separates posts to 20 [IMG] max.
this collects all tweets urls and tweet text from the tweet thread including author and user replies.
good for extracting threads with multiple image contributionss.


Changelog for "Nc5v3"​

Version Nc5v3​

Release Date: [Insert Date]

New Features and Improvements​

  1. Grouping Tweets into Chains:
    • Introduced a new feature to group formatted tweets into "chains" or threads based on the number of images (more than 20) or when reaching the end of the list of tweets.
    • Each chain includes links to the original tweets, quoted tweets, images, and videos.
  2. Support for Video URLs:
    • Added support for extracting and formatting video URLs from tweets.
    • Videos are now included in the output with their respective URLs.
  3. Enhanced Formatting:
    • Improved formatting for each chain to include spoiler sections for thread continuation URLs and full text with large images.
    • Added a link to a guide on how to post tweets in this format.
  4. Notification Update:
    • Updated the notification message to reflect both the number of chains and the total number of tweets processed.
    • Example: "Copied: X chains (Y tweets)"

Bug Fixes and Optimizations​

  1. Consistent URL Handling:
    • Ensured consistent handling of URLs by replacing nitter.poast.org with twitter.com across all links.
  2. Quoted Tweet Extraction:
    • Improved extraction logic for quoted tweets to ensure accurate capture and formatting.
  3. Video URL Handling:
    • Enhanced video URL extraction to handle different types of video sources correctly.
  4. HTML Element Conversion:
    • Optimized conversion of HTML elements like links and line breaks into plain text format.

Detailed Summary in Layman's Terms​

What Does This New Bookmarklet Do?​

  • Identify Tweets: Finds all the tweets on the current page.
  • Filter by User: Filters these tweets to only include those posted by a specific user.
  • Extract Content: For each tweet, it extracts:
    • The text content.
    • Any quoted tweets within this tweet.
    • Links to any images or videos in the tweet.
  • Group into Chains: If there are more than 20 images or if it reaches the end of all available tweets, it groups these formatted tweets into "chains" or threads.
  • Copy to Clipboard: Once all chains are formed, it combines them into one large string and copies this string to your clipboard.
  • Notification: A notification box appears briefly indicating that copying is complete.

Summary​

  • Identify Tweets: Finds all tweets on the current page.
  • Filter by User: Filters tweets to only include those from a specific user.
  • Extract Content: Extracts text, quoted tweets, images, and videos from each tweet.
  • Group into Chains: Groups these formatted tweets into "chains" or threads if there are more than 20 images or at the end of all available tweets.
  • Copy to Clipboard: Copies all formatted text into your clipboard with a notification indicating completion.


Notification Message​

After copying the formatted text to your clipboard, a notification box will appear briefly showing something like:
text
Copied: X chains (Y tweets)
Where X represents the number of chains (threads) and Y represents the total number of tweets processed.

Code:
https://twitter.com/username/status/1234567890
[SPOILER="thread continued"]
https://twitter.com/username/status/1234567891
https://twitter.com/username/status/1234567892
[/SPOILER]

[SPOILER="full text & large images"]
1/3
@username
This is a sample tweet with some text.

[img]https://pbs.twimg.com/media/image.jpg[/img]

2/3
@username
This is another sample tweet with some more text.

[Quoted tweet]
This is a quoted tweet from someone else.
[U][URL]https://twitter.com/someoneelse/status/9876543210[/URL][/U]

3/3
@username
And this is yet another sample tweet with even more text.

[U][URL]https://video.twimg.com/ext_tw_video/...[/URL][/U]

[COLOR=rgb(184, 49, 47)][B][SIZE=5]To post tweets in this format, more info here: [URL]https://www.thecoli.com/threads/tips-and-tricks-for-posting-the-coli-megathread.984734/post-52211196[/URL][/SIZE][/B][/COLOR]
[/SPOILER]

[threads continued]

https://twitter.com/username/status/1234567893
[SPOILER="thread continued"]
https://twitter.com/username/status/1234567894
https://twitter.com/username/status/1234567895
[/SPOILER]

[SPOILER="full text & large images"]
4/6
@username
Another sample...

5/6
@username
Yet another...

6/6
@username
Final sample...

[COLOR=rgb(184, 49, 47)][B][SIZE=5]To post tweets in this format, more info here: [URL]https://www.thecoli.com/threads/tips-and-tricks-for-posting-the-coli-megathread.984734/post-52211196[/URL][/SIZE][/B][/COLOR]
[/SPOILER]
 

Box Factory

hater
Joined
May 14, 2014
Messages
21,027
Reputation
-414
Daps
53,331
Reppin
#byrdgang
Anyone know how to switch back to mobile view?

It switched to desktop yesterday and I can't find how to switch it bavk
 

bnew

Veteran
Joined
Nov 1, 2015
Messages
57,350
Reputation
8,496
Daps
160,046

Detailed Summary of the Bookmarklet Code for Bsky/Bluesky​

What the Code Does:​

This updated bookmarklet is a small piece of JavaScript code that you can run on a Bsky (Bluesky) web page to extract and format post content from a thread, specifically focusing on posts made by the original thread author. Here’s an extensive, detailed summary in layman terms:

1. Ensure Page is Fully Loaded

  • The code waits until the webpage has fully loaded and all elements are visible.

2. Identify Posts in the Thread

  • It finds all posts in the current thread using specific identifiers ([data-testid^="postThreadItem-by-"]).

3. Identify Original Thread Author

  • It determines the username of the person who started the thread (the original author).

4. Filter Posts by Author

  • The code only processes posts made by this original author, ignoring posts from other users.

5. Extract Post Content with Options

  • For each post by the original author, it extracts several pieces of information:
    • Author: The username of the person who made the post (which will always be the original author).
    • Post Text: The actual content of the post.
    • Post URL: The URL of the individual post.
    • Quoted Posts: If there are any quoted posts within the current post, it extracts these up to a maximum number defined by maxRepliesToExtract.
    • Images: It finds any images in the post and includes their URLs.

6. Limit Number of Posts Extracted

  • The code can be configured to extract either all posts by the original author or a limited number of posts (up to maxPostsToExtract). This is controlled by the includeAllPosts option.
  • If includeAllPosts is false, it will only extract up to maxPostsToExtract posts.

7. Process Quoted Posts

  • If a post includes quoted content from another user, it extracts this quoted text up to a maximum of maxRepliesToExtract quotes per post.
  • These quoted texts are added below their respective main posts.

8. Format Extracted Content

  • The extracted information is formatted into a structured text format:
    • Each post is numbered (e.g., "1/5" for the first post out of 5).
    • The author's username is included.
    • The post URL is included.
    • The actual text content of the post is included.
    • Any quoted posts are added below their respective main posts.

9. Include Thread URL

  • The URL of the current thread is added at the beginning of the output.

10. Create Spoiler Tag

  • The formatted text is wrapped inside a [SPOILER="full text & large images"] tag to hide it initially.
[SPOILER="full text & large images"]

11. Copy Formatted Text

  • A textarea element is created with the formatted text, selected, and then copied to your clipboard.
  • After copying, the textarea element is removed from the page.

12. Display Notification

text
- A notification box appears briefly to inform you that the text has been copied successfully.

Key Features:​

  • Thread URL: The URL of the current thread is included at the top of the output.
  • Post Content by Original Author: Only extracts and includes posts made by the original thread author.
  • Quoted Posts: Includes any quoted posts within each main post up to a specified limit (maxRepliesToExtract).
  • Images: Extracts and includes URLs of images found in posts.
  • Optional Post Limits: You can set whether to extract all posts or limit it to a maximum number (maxPostsToExtract) by adjusting includeAllPosts.
  • Max Replies Per Post: You can set a maximum number of replies (maxRepliesToExtract) to be extracted per post.

How to Use:​

  1. Create a Bookmarklet: Save this JavaScript code as a bookmark in your browser.
  2. Navigate to Bsky/Bluesky Thread: Go to any thread on Bsky/Bluesky where you want to extract posts.
  3. Run the Bookmarklet: Click on the bookmarklet you created.
  4. Adjust Options: Modify the values of includeAllPosts, maxPostsToExtract, and maxRepliesToExtract as needed before running the bookmarklet.
This tool simplifies capturing and sharing content from Bsky/Bluesky threads by focusing only on posts made by the original author, providing flexible options for controlling what and how much content is extracted.



Code:
https://bsky.app/profile/godpod.bsky.social/post/3lbn5hn4zjk2w

[SPOILER="full text & large images"]

1/1
@God

Someone called this mass exodus from Twitter ‘the fall of the Broman Empire’ and I died laughing. 💀

[/SPOILER]
 
Last edited:

bnew

Veteran
Joined
Nov 1, 2015
Messages
57,350
Reputation
8,496
Daps
160,046
.

Summary of What the Code Does on Bluesky (bsky.app)

The code you provided is a bookmarklet script designed to extract and format posts (or threads) from Bluesky (bsky.app) and make them easy to copy. It creates a custom input tool that lets you decide how many posts to grab, and then formats those posts into a structured format, which can include the original post content, any quoted replies, and images. Below is an extensive, detailed summary of what the code does, using simple terms.

1. Displaying a Custom Pop-up to Select Number of Posts

When you run the script, it starts by creating a popup on your screen. This popup asks you to input the number of posts you want to extract from the current page on Bluesky. You can think of it like a calculator where you can input a number.
  • What Happens?
    • A pop-up window appears over the page, slightly darkening the rest of the content to grab your attention.
    • Inside the popup, there is a number input field where you can type a number (e.g., 10 or 20), which is the number of posts you want to extract.
    • There are also buttons to clear the input field or to submit the number you entered.
  • Why is this useful?
    • This lets you decide how many posts to pull from the current Bluesky page, instead of manually copying everything.

2. Extracting Post Data from Bluesky

Once you’ve entered a number and clicked the “Set Number of Posts” button, the script starts extracting the posts. Here’s how it works:
  • What Happens?
    • The script looks at the page and grabs the posts displayed there.
    • It checks each post to pull out useful information, like the post author's name, the post content, any quoted replies within the post, and any images shared in the post.
  • Why is this useful?
    • You can grab all the important details from posts quickly and automatically, without having to go through each post manually.

3. Handling Quoted Posts (Replies)

In Bluesky, users can quote other posts and reply to them. The script also extracts these quoted replies and formats them.
  • What Happens?
    • When a post contains replies or quotes of other posts, the script finds those replies and pulls out the quoted text and the user who originally posted it.
    • It formats the quotes by showing which post they came from (e.g., "@UserName: quoted post content").
  • Why is this useful?
    • If a post is part of a thread (i.e., it replies to another post), the script gathers all the context, making sure you see the full conversation, not just individual posts.

4. Removing Post URLs (Optional)

There’s an option to remove post URLs from the extracted data. When the flag includeReplyPostUrls is set to false, the script removes any links to other posts (URLs) from the extracted text.
  • What Happens?
    • If you set the option to remove post URLs, the script will remove the links to the specific post pages from the extracted content.
    • For example, if someone is quoting another post, the script won’t include the URL of that post in the output.
  • Why is this useful?
    • This feature ensures that the extracted content focuses only on the text and images, without cluttering the output with links to individual posts. This can make the content cleaner, especially when you're copying or sharing it.

5. Formatting and Copying the Extracted Data

Once the script finishes pulling and processing the posts, it formats them into a special structure for easy copying.
  • What Happens?
    • The posts are formatted as a listwith the following elements:
      • Post number (1/3, 2/3, etc.)
      • Post author's username
      • The post content
      • Quoted replies (if there are any)
      • Images (if any are attached to the post)
    • All the extracted data is wrapped inside a spoiler tag (useful for formatting long or large amounts of text).
    • Then, the script creates a textarea (a box where you can select text), and all the formatted post content is placed inside that box.
    • The content is automatically copied to your clipboard.
  • Why is this useful?
    • You can quickly copy the full text of the posts, including any replies and images, to paste elsewhere (like in a document or message) without needing to manually copy each post.
    • The script also shows you a notification after it copies the content, telling you how many posts were copied.

6. Displaying a Notification

After the posts are copied, a small notification appears on the screen to let you know how many posts were successfully copied.
  • What Happens?
    • A small notification box shows up at the bottom-left corner of the screen, telling you something like: "Copied: X posts."
    • The notification box then disappears after a short time.
  • Why is this useful?
    • This is a helpful confirmation, so you know that the script has finished its job and you’ve successfully copied the data.

Summary of What the Code Does:

  • Creates a simple interface for you to choose how many posts to extract.
  • Extracts detailed data from the selected number of posts, including text, quoted replies, and images.
  • Cleans up the data by removing unwanted post URLs (optional) from replies.
  • Formats the extracted data into a clean, structured format that’s easy to copy.
  • Automatically copies the formatted posts to your clipboard and shows a notification confirming the action.

Why Is This Useful for Bluesky Users?

If you want to quickly gather a bunch of posts (and their replies) from a Bluesky thread, this script automates the process. It saves you time and effort, especially if you want to grab a large number of posts or share content from the platform without manually copying and pasting everything. The clean formatting makes it easy to share the posts, complete with images, quoted replies, and without unwanted URLs (if you choose).

hj0SpYc.png




Code:
[URL unfurl="true"]https://bsky.app/profile/karengeier.com/post/3lc6omqnrj22k[/URL]

[SPOILER="full text & large images"]

1/3
@Karen Geier

Incredible bit

2/3
@‪Tommy K‬ ‪@tpk77.bsky.social‬

She should probably be facing the other way

3/3
@‪anaesim.bsky.social‬ ‪@anaesim.bsky.social‬

It's the effort that counts

[/SPOILER]
 

bnew

Veteran
Joined
Nov 1, 2015
Messages
57,350
Reputation
8,496
Daps
160,046
adjust the flags accordingly for multiple bookmarklet setting variations.

Changes Made:​

  1. New Flag: includeMainAndRepliesOnly
    • This flag controls whether to only include posts by the main author and their immediate replies.
    • If set to true, the script will only extract posts made by the main author and their direct replies (i.e., the posts immediately following theirs in the thread).
  2. Post Filtering Logic:
    • In the extractPosts() function, a check is added to ensure only the main author’s posts and replies to those posts are included.
  3. Other Considerations:
    • The script filters posts based on whether they are replies to the main author's previous post, ensuring the continuity of the thread is maintained.
With this update, you can now easily toggle the includeMainAndRepliesOnly flag to extract posts either from the main author and their replies or from the entire thread.



 

bnew

Veteran
Joined
Nov 1, 2015
Messages
57,350
Reputation
8,496
Daps
160,046
another variation of the bluesky bookmarklet.

Key Changes:​

  1. Extract Up to 12 Posts Max:
    • Added maxPostsToExtract variable and used it in a loop condition to limit the number of posts extracted.
    • Introduced includeAllPosts option to choose between extracting all posts or up to maxPostsToExtract.
  2. Option to Extract All Posts:
    • Added includeAllPosts boolean variable. If set to true, it extracts all posts; otherwise, it extracts up to maxPostsToExtract.
  3. Option to Set Max Number of Post Replies:
    • Introduced maxRepliesToExtract variable and used it within the loop that processes quoted posts.
    • This ensures that only up to maxRepliesToExtract replies are included for each post.

How to Use:​

  • Navigate to Bsky/Bluesky Thread: Go to any thread on Bsky/Bluesky where you want to extract posts.
  • Run the Bookmarklet: Click on the bookmarklet you created.
  • Adjust Options: Modify the values of includeAllPosts, maxPostsToExtract, includeReplyPostUrls, and maxRepliesToExtract as needed before running the bookmarklet.
This updated version provides more flexibility in controlling how many posts and replies are extracted, making it more versatile for different use cases.


 

bnew

Veteran
Joined
Nov 1, 2015
Messages
57,350
Reputation
8,496
Daps
160,046
this gets all posts visible in the DOM AKA the webpage. it's not ideal since it can extract 50 posts which can easily exceed the 13-13k character post limit on thecoli.


Detailed Summary of the Bookmarklet Code for Bsky/Bluesky​

What the Code Does:​

This bookmarklet is a small piece of JavaScript code that you can run on a Bsky (Bluesky) web page to extract and format post content from a thread. Here’s a step-by-step explanation in layman terms:

1. Ensure Page is Fully Loaded

  • The code waits until the webpage has fully loaded and all elements are visible.

2. Identify Posts in the Thread

  • It finds all posts in the current thread using specific identifiers ([data-testid^="postThreadItem-by-"]).

3. Extract Post Content

  • For each post, it extracts several pieces of information:
    • Author: The username of the person who made the post.
    • Post Text: The actual content of the post.
    • Post URL: The URL of the individual post (optional, controlled by includeReplyPostUrls).
    • Quoted Posts: If there are any quoted posts within the current post, it extracts those as well.
    • Images: It finds any images in the post and includes their URLs.

4. Process Quoted Posts

  • If a post includes quoted content from another user, it extracts this quoted text and adds it to the main post content.

5. Format Extracted Content

  • The extracted information is formatted into a structured text format:
    • Each post is numbered (e.g., "1/50" for the first post out of 50).
    • The author's username is included.
    • If enabled, the post URL is included.
    • The actual text content of the post is included.
    • Any quoted posts are added below their respective main posts.

6. Include Thread URL

  • The URL of the current thread is added at the beginning of the output.

7. Create Spoiler Tag

  • The formatted text is wrapped inside a [SPOILER="full text & large images"] tag to hide it initially.
    [/SPOILER]
[SPOILER="full text & large images"]

8. Copy Formatted Text

  • A textarea element is created with the formatted text, selected, and then copied to your clipboard.
  • After copying, the textarea element is removed from the page.

9. Display Notification

  • A notification box appears briefly to inform you that the text has been copied successfully.

Key Features:​

  • Thread URL: The URL of the current thread is included at the top of the output.
  • Post Content: Extracts and includes all text content from each post in the thread.
  • Quoted Posts: Includes any quoted posts within each main post.
  • Images: Extracts and includes URLs of images found in posts.
  • Optional Post URLs: You can choose whether to include individual post URLs for replies by setting includeReplyPostUrls to true or false.

How to Use:​

  1. Create a Bookmarklet: Save this JavaScript code as a bookmark in your browser.
  2. Navigate to Bsky/Bluesky Thread: Go to any thread on Bsky/Bluesky where you want to extract posts.
  3. Run the Bookmarklet: Click on the bookmarklet you created.
  4. Copy and Use: The formatted text will be copied to your clipboard, ready for use elsewhere.
This tool simplifies the process of capturing and sharing content from Bsky/Bluesky threads by automating the extraction and formatting process.


 

bnew

Veteran
Joined
Nov 1, 2015
Messages
57,350
Reputation
8,496
Daps
160,046
has thread continues spoiler for links by the thread author , hyperlinks fixed.
text may not always be formatted correctly when hyperlinks are present.


Summary of the Code's Functionality on bsky/bluesky posts/threads​

  1. Prompt for Number of Posts:
    • The code starts by creating a prompt that asks the user to enter the number of posts they want to extract. This prompt is displayed as an overlay on the webpage.
  2. Extract Posts:
    • Once the user enters the number of posts, the code extracts the specified number of posts from the bsky/blueky thread. It looks for posts that match a specific pattern in the HTML structure.
  3. Identify Post Content:
    • For each post, the code identifies the content of the post. This includes the text, hyperlinks, images, and quoted posts within the post.
  4. Format Hyperlinks:
    • The code finds all hyperlinks within the post content and formats them using BBCode. This means it wraps each hyperlink in special tags that make the link underlined and clickable when displayed on certain forums.
  5. Format Images:
    • The code also finds all images within the post content and formats them using BBCode. This means it wraps each image URL in special tags that display the image when the post is viewed on certain forums.
  6. Format Quoted Posts:
    • If the post contains any quoted posts, the code extracts the content of these quoted posts and formats them using BBCode. This includes the author's name, the URL of the quoted post, and the quoted content.
  7. Combine Post Content:
    • The code combines all the formatted content (text, hyperlinks, images, and quoted posts) into a single string for each post.
  8. Format Final Output:
    • The code then formats the combined post content into a final output string. This includes adding headers, footers, and other formatting to make the output look nice and organized.
  9. Copy to Clipboard:
    • Finally, the code copies the formatted output to the user's clipboard so they can easily paste it into another application or forum.
  10. Display Notification:
    • The code also displays a notification to let the user know that the posts have been copied to the clipboard.

Example of How the Code Works​

Imagine you are reading a thread on bsky/blueky and you want to extract some posts to share on another forum. Here's how the code helps:
  1. Prompt:
    • You see a prompt asking you to enter the number of posts you want to extract. You type "3" and press enter.
  2. Extract Posts:
    • The code finds the first 3 posts in the thread and starts processing them.
  3. Identify Post Content:
    • For each post, the code looks at the text, hyperlinks, images, and quoted posts.
  4. Format Hyperlinks:
  5. Format Images:
  6. Format Quoted Posts:
    • If a post contains a quoted post from another user, the code formats it as [QUOTED POST]\n@Author\nhttps://www.example.com/quoted-post\nQuoted content.
  7. Combine Post Content:
    • The code combines all the formatted content into a single string for each post.
  8. Format Final Output:
    • The code adds headers and footers to the combined content to make it look nice and organized.
  9. Copy to Clipboard:
    • The code copies the final formatted output to your clipboard.
  10. Display Notification:
    • A notification pops up saying "Copied: 3 posts" to let you know that the posts have been copied.




edit: had to re-upload the correct script . the non-working script was up for about an hour




Code:
https://bsky.app/profile/ctraveler.bsky.social/post/3lccwnmnw7c2p


[SPOILER="thread continued"]


[/SPOILER]


[SPOILER="full text & large images"]


1/12

@C_Traveler💙


[U][URL]https://www.thelondoneconomic.com/news/media/european-federation-of-journalists-to-stop-posting-content-on-x-38658/[/URL][/U]25,000 journalists from 44 countries will stop posting content on X. We are making change and the world has spoken.


www.thelondoneconomic.com/news/media/e...


[img]https://cdn.bsky.app/img/feed_thumbnail/plain/did:plc:spygj7547teongqzd4odwrgq/bafkreigqhi65cjave2lk3rnjbvbqwbl2pyr3jdxgzmvabv7wuf5ty4hf6a@jpeg[/img]


2/12

@‪Roscoe McGuillacuddy‬ ‪@dkmcclung.bsky.social‬


💯👏👏👏👏👏


3/12

@‪Glathgrundel‬ ‪@glathgrundel.bsky.social‬


Musk telling the 'little people' that they are too small and insignificant to make a difference isn't working out the way he imagined it would.


4/12

@‪Xergg‬ ‪@xergg.bsky.social‬


For those who wonder what difference this will make to you, twitter isn't where you will go to get news ( if you do )


5/12

@‪Grant Mooney‬ ‪@grantmooney.bsky.social‬


Gotta give Elon at least a little credit for naming the platform "Ex" before everybody left it


6/12

@‪@rosi-cmatos.bsk...‬ ‪@rosi-cmatos.bsky.social‬


Soon everything goes back to normal.


7/12

@‪'(Masataro Asai Ph . D)‬ ‪@guicho271828.bsky.social‬


Typical Elon response would be ... hmm ... something like "Journalists are suppressing speech by not posting!"


8/12

@‪lolabud.bsky.social‬ ‪@lolabud.bsky.social‬


Let Maga have x so they can drive each other crazy . They are like a bunch of little dogs bitting at everyone's ankles !


9/12

@‪adi84.bsky.social‬ ‪@adi84.bsky.social‬


They're on sky now too. They're flocking over to troll.


10/12

@‪Not your Comrade‬ ‪@notyourcomrade.bsky.social‬


I just hope we are calling this x-odus


11/12

@‪Michael O' 🇮🇪‬ ‪@socratesxxx.bsky.social‬


Very clever😆


12/12

@‪LaGarce‬ ‪@gizzylagarce.bsky.social‬


Hey Elon, you shrimp dikk ass wipe 🤮


[COLOR=rgb(184, 49, 47)][B][SIZE=5]To post tweets in this format, more info here: [URL]https://www.thecoli.com/threads/tips-and-tricks-for-posting-the-coli-megathread.984734/post-52211196[/URL][/SIZE][/B][/COLOR]

[/SPOILER]


2nd edit:
this is suppose to sanitize an emoji that tends to be in usernames but isn't supported by current forum software for posting. still has issues with some text placement

* tweaked with deepseek 2.5 coder .. internal v3.4.3

 
Last edited:

bnew

Veteran
Joined
Nov 1, 2015
Messages
57,350
Reputation
8,496
Daps
160,046

bnew

Veteran
Joined
Nov 1, 2015
Messages
57,350
Reputation
8,496
Daps
160,046
turns out the bluesky / bsky bookmarklets have a bug in if the output contains certain emojis in the username then thecoli xenforo software won't allow it to be posted unless you remove those emoji characters next to the username. I may go back and update the previous code but it's not a priority for me right now. also some letters like "b" that comes after "#" like #blacksky" get removed for some reason and looks like "#lacksky" . i think i've noticed that with other characters and maybe even after the "@". i might start all over again since i don't really know what i'm doing. I should have started with a script that could get all data no matter what and then build versions of a main script that could do that everything but par it down for certain types of output but I didn't plan ahead.


edit:
12/6/24
i realized this line const symbolsToRemove = /[\u2764\u1F90D\u1F49B\u1F49A\u1F499\u1F49C]/g; was causing the missing characters issue.
i also removed the "@" before nicknames instead of removing emojis from nicknames so the posts can go through.

old line:
return `${index + 1}/${postTexts.length}\n@${post.author}\n${post.url}\n${post.text}`;

new line:
return `${index + 1}/${postTexts.length}\n${post.author}\n${post.url}\n${post.text}`;

old line:
return `[QUOTED POST]\n@${quoteAuthor}\n${quoteUrl}\n${quoteContent}`;

new line:
return `[QUOTED POST]\n${quoteAuthor}\n${quoteUrl}\n${quoteContent}`;
it still doesn't support outputting quoted posts yet :francis:
i want to get a solid base to build off of before going back and updating the previous bookmarklets, but the code below works well enough for the time being.


partially working code with playlist support.


* note theres a annoying bug if you go to one post and click on a reply or go to a users timeline and click on a another post using the same tab, the bookmarklet will grab the very first post instead. you have to refresh the tab on the new post.
 
Last edited:
Top