bnew

Veteran
Joined
Nov 1, 2015
Messages
54,105
Reputation
8,072
Daps
153,685
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
54,105
Reputation
8,072
Daps
153,685
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
54,105
Reputation
8,072
Daps
153,685
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: "nc6.v2.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: "nc6.v2.4 (Restarting Numbering Sequence) Bookmarklet"​



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"​



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
54,105
Reputation
8,072
Daps
153,685
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.




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
54,105
Reputation
8,072
Daps
153,685
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]
 
Top