GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Conversation

Notices

  1. Embed this notice
    Terence Eden (edent@mastodon.social)'s status on Sunday, 11-Aug-2024 03:30:36 JST Terence Eden Terence Eden

    Boring technical question which neither the documentation nor ChatGPT can answer.

    I want to automate screenshots using #Python's #Selenium Webdriver with #Chrome.

    This works - but the non-logged in experience of Twitter forces dark-mode.

    I want a light-mode screenshot.

    I can't find a way to set SEC-CH-PREFERS-COLOR-SCHEME in Selenium. Nor can I find a light-mode toggle for non-logged in Twitter users.

    Any clues gang?

    (I want to automate replacing my Twitter embeds with a screenshot.)

    In conversation about 10 months ago from mastodon.social permalink
    • Embed this notice
      Eaton (eaton@phire.place)'s status on Sunday, 11-Aug-2024 03:30:31 JST Eaton Eaton
      in reply to
      • Simon Willison

      @Edent @simon I ended up leaning on parsing of exported archives to handle threads, but it (naturally) chokes on threads with multiple participants.

      In conversation about 10 months ago permalink
    • Embed this notice
      Terence Eden (edent@mastodon.social)'s status on Sunday, 11-Aug-2024 03:30:32 JST Terence Eden Terence Eden
      in reply to
      • Simon Willison

      @simon Ooooh. Possibly. I used to do epic things with their threading API. Not sure if it's still possible - but I'll put it on the roadmap.

      Next step is quotes and replies.

      If I can get that working, then it *should* be possible.

      In conversation about 10 months ago permalink
    • Embed this notice
      Terence Eden (edent@mastodon.social)'s status on Sunday, 11-Aug-2024 03:30:34 JST Terence Eden Terence Eden
      in reply to

      I think that's good enough for the basics.

      This code will (eventually) convert all your embedded Tweets into proper semantic HTML without any tracking back to Twitter.

      Rough code at:
      https://github.com/edent/Tweet2Embed

      In conversation about 10 months ago permalink

      Attachments


      1. https://files.mastodon.social/media_attachments/files/112/937/248/159/154/502/original/b0765f170f937619.png
      2. Domain not in remote thumbnail source whitelist: opengraph.githubassets.com
        GitHub - edent/Tweet2Embed: Convert a public Tweet into embedded semantic HTML
        Convert a public Tweet into embedded semantic HTML - edent/Tweet2Embed
    • Embed this notice
      Terence Eden (edent@mastodon.social)'s status on Sunday, 11-Aug-2024 03:30:34 JST Terence Eden Terence Eden
      in reply to

      OK gang! This is ready for you to test.

      python tweet2html.py --css 1234

      That will take a Twitter ID and return HTML and CSS for you to embed in your website with no calling back to Twitter.

      Features:
      🗣 Avatars inlined as Base64 WebP
      📸 All attached photos inlined
      🎥 Video poster inline, <video> to original source
      🔗 Hyperlinks don't use t.co
      #️⃣ Hashtags and @ mentions linked
      🕰 Semantic time
      ♥ and 🗨 counts

      Try it out at https://github.com/edent/Tweet2Embed

      Feedback and pull requests very welcome!

      In conversation about 10 months ago permalink

      Attachments

      1. No result found on File_thumbnail lookup.
        t.co / Twitter

      2. https://files.mastodon.social/media_attachments/files/112/938/843/698/648/144/original/f1284e758c3f1574.png


    • Embed this notice
      Simon Willison (simon@fedi.simonwillison.net)'s status on Sunday, 11-Aug-2024 03:30:34 JST Simon Willison Simon Willison
      in reply to

      @Edent any chance it could handle tweet threads in the future?

      I have some /epic/ threads I want to archive, 100+ tweets chained together, most of which are themselves quote-tweets

      This one for example (only properly visible if you are signed in to Twitter) https://twitter.com/simonw/status/1077737871602110466

      In conversation about 10 months ago permalink

      Attachments


    • Embed this notice
      Terence Eden (edent@mastodon.social)'s status on Sunday, 11-Aug-2024 03:30:35 JST Terence Eden Terence Eden
      in reply to

      Someone complained that an image with decent alt text wasn't accessible.

      So now I'm practising Spite-Driven-Development to create a semantic HTML embed.

      Doesn't look *totally* accurate - but not bad for a dozen lines of CSS.

      In conversation about 10 months ago permalink

      Attachments


      1. https://files.mastodon.social/media_attachments/files/112/934/046/056/059/961/original/57de45d2b8455611.png

    • Embed this notice
      Terence Eden (edent@mastodon.social)'s status on Sunday, 11-Aug-2024 03:30:35 JST Terence Eden Terence Eden
      in reply to

      Spite-Driven-Development continues.

      I now have a scrap of semantic HTML which adequately replicates an embedded Tweet.

      TODO:

      * Add images
      * Add entities (hashtags, mentions, links)
      * Add parent of thread
      * Add quoted tweet
      * Add ... whatever else

      Should be able to hijack the embed API to get most metadata (no number or replies / retweets though).

      In conversation about 10 months ago permalink

      Attachments


      1. https://files.mastodon.social/media_attachments/files/112/936/550/436/439/765/original/94c17ede19ed42fc.png
    • Embed this notice
      Terence Eden (edent@mastodon.social)'s status on Sunday, 11-Aug-2024 03:30:35 JST Terence Eden Terence Eden
      in reply to

      Parents and Quotes are just <blockquotes> within <blockquotes>. So that was easy!

      In conversation about 10 months ago permalink

      Attachments


      1. https://files.mastodon.social/media_attachments/files/112/936/615/290/145/859/original/48b552bdc96108cf.png
    • Embed this notice
      Terence Eden (edent@mastodon.social)'s status on Sunday, 11-Aug-2024 03:30:36 JST Terence Eden Terence Eden
      in reply to
      • samir, object-disoriented

      Aha! There's a way to cheat!

      The old Twitter embed API lets you manually specify colour scheme - and is easy to screenshot.

      For example: https://platform.twitter.com/embed/Tweet.html?dnt=true&embedId=twitter-widget-0&frame=false&hideCard=false&hideThread=true&id=1420704988825800704&lang=en&theme=light&width=550px

      Hopefully I can replace all the Twitter embeds on my website with images (and, yes, I will add alt text).

      Thanks @samir for giving me the inspiration.

      In conversation about 10 months ago permalink

      Attachments

      1. No result found on File_thumbnail lookup.
        Twitter Embed
    • Embed this notice
      Terence Eden (edent@mastodon.social)'s status on Sunday, 11-Aug-2024 03:30:36 JST Terence Eden Terence Eden
      in reply to

      Any #Selenium experts in the house?

      All my screenshots are slightly fuzzy. Why?!?!

      I'm using the Chromium webdriver. Grabbing the area with `element.screenshot_as_png`

      Is it because I have fractional scaling? Wayland?

      I have set `chrome_options.add_argument("--ozone-platform=wayland")` but to no avail.

      This'll be a two-drink minimum problem, I reckon.

      In conversation about 10 months ago permalink

      Attachments


      1. https://files.mastodon.social/media_attachments/files/112/928/468/937/855/057/original/c4e50771fcdbf355.webp
    • Embed this notice
      Terence Eden (edent@mastodon.social)'s status on Sunday, 11-Aug-2024 03:30:36 JST Terence Eden Terence Eden
      in reply to

      OK, if you have lots of Twitter embeds in your website, I've written an easy(ish) way to replace them with static images & alt text.

      https://github.com/edent/Tweet2Img

      Run:
      `python tweet2img.py 1234`

      And you'll get a ready-to-paste piece of HTML with a data-encoded image.

      `<a href="https:/ /twitter.com/edent/status/123"><img src="data:image/webp;base64,Ukl..." width="550" height="439" alt="text from tweet."/></a>`

      It also saves the WebP and alt text if you need them.

      In conversation about 10 months ago permalink

      Attachments


    • Embed this notice
      Eaton (eaton@phire.place)'s status on Monday, 12-Aug-2024 03:20:38 JST Eaton Eaton
      in reply to
      • Colby Russell
      • Darius Kazemi
      • Simon Willison

      @simon @darius @colby @Edent i’ve been noodling with that and testingways of slowly transitioning media to other sources loke vimeo/youtube/etc. but it’s no small thing; it sobered me up to realize how dependent we’ve all become on an invisibly free slurry of forgettable storage

      In conversation about 10 months ago permalink
    • Embed this notice
      Simon Willison (simon@fedi.simonwillison.net)'s status on Monday, 12-Aug-2024 03:20:39 JST Simon Willison Simon Willison
      in reply to
      • Colby Russell
      • Darius Kazemi
      • Eaton

      @darius @colby @eaton @Edent yeah that’s what’s held me back in the past too - hosting my own tweets is obviously fine, embedding full videos from quotes tweets much less so

      I don’t want to republish those videos though, I want to stash a personal copy in case Twitter fully implodes some day

      In conversation about 10 months ago permalink
    • Embed this notice
      Darius Kazemi (darius@friend.camp)'s status on Monday, 12-Aug-2024 03:20:40 JST Darius Kazemi Darius Kazemi
      in reply to
      • Colby Russell
      • Simon Willison
      • Eaton

      @simon @colby @eaton @Edent my assumption is I don't have a moral right to rehost other people's content I've quoted so I just render it as a URL

      In conversation about 10 months ago permalink
    • Embed this notice
      Simon Willison (simon@fedi.simonwillison.net)'s status on Monday, 12-Aug-2024 03:20:41 JST Simon Willison Simon Willison
      in reply to
      • Colby Russell
      • Darius Kazemi
      • Eaton

      @darius @colby @eaton @Edent I care about threads that were entirely me replying to myself, but those replies include quotes of other tweets that I want to capture as well

      In conversation about 10 months ago permalink
    • Embed this notice
      Darius Kazemi (darius@friend.camp)'s status on Monday, 12-Aug-2024 03:20:42 JST Darius Kazemi Darius Kazemi
      in reply to
      • Colby Russell
      • Simon Willison
      • Eaton

      @colby @eaton @Edent @simon mine is designed to only show posts from the originating user though, so multiple participants isn't something it's designed to handle

      In conversation about 10 months ago permalink
    • Embed this notice
      Colby Russell (colby@kosmos.social)'s status on Monday, 12-Aug-2024 03:20:43 JST Colby Russell Colby Russell
      in reply to
      • Darius Kazemi
      • Simon Willison
      • Eaton

      @eaton you may or may not already be familiar with @darius's <https://tinysubversions.com/twitter-archive/>.

      (not uncc'd: @Edent @simon)

      In conversation about 10 months ago permalink

      Attachments

      1. No result found on File_thumbnail lookup.
        @tinysubversions Twitter archive
    • Embed this notice
      Eaton (eaton@phire.place)'s status on Monday, 12-Aug-2024 06:33:11 JST Eaton Eaton
      in reply to
      • Colby Russell
      • Darius Kazemi
      • Simon Willison

      @simon @darius @colby @Edent exactly. Would love to hear future updates about how that plays out !

      In conversation about 10 months ago permalink
    • Embed this notice
      Simon Willison (simon@fedi.simonwillison.net)'s status on Monday, 12-Aug-2024 06:33:12 JST Simon Willison Simon Willison
      in reply to
      • Colby Russell
      • Darius Kazemi
      • Eaton

      @eaton @darius @colby @Edent I recently posted the first video on my blog that was hosted by me (an mp4 file in a video element) as opposed to hosted on YouTube or similar: https://simonwillison.net/2024/Jul/29/sam-2/

      It's in my S3 bucket along with all my other images, but I have to admit I do worry that some day decades into the future I may fail to pay my AWS bill and risk my S3 bucket blinking out of existence

      In conversation about 10 months ago permalink

      Attachments


    • Embed this notice
      Terence Eden (edent@mastodon.social)'s status on Wednesday, 14-Aug-2024 16:01:56 JST Terence Eden Terence Eden
      in reply to

      Now also shows parents to replies, and full content of quotes.

      And polls!

      HTML validates!

      Play with the code at https://github.com/edent/Tweet2Embed

      I'll be doing this for Mastodon later - because I really don't like iFrame embeds!

      In conversation about 9 months ago permalink

      Attachments


      1. https://files.mastodon.social/media_attachments/files/112/939/531/239/490/933/original/a0447370fa81fd2e.png

      Ryan Castellucci :nonbinary_flag: and esmevane, sorry repeated this.
    • Embed this notice
      Terence Eden (edent@mastodon.social)'s status on Wednesday, 14-Aug-2024 16:01:56 JST Terence Eden Terence Eden
      in reply to

      OK! I *think* I've finished.

      You can now "rescue" any embedded Tweet and recreate it as simple HTML - no tracking.

      Includes:

      🗣 Avatars inlined as WebP
      📸 All attached photos inlined
      🎥 Video poster inline, <video> to original mp4
      🔗 Hyperlinks don't use t.co
      #️⃣ Hashtags & @ mentions linked
      🔄 Includes reply threads & quote Tweets
      🕰 Semantic time
      🔍 Schema.org metadata
      🖼 Cards
      📊 Polls
      ♥ , ♻ & 🗨 counts

      One command. No API key needed.

      Code at https://github.com/edent/Tweet2Embed

      Feedback *very* much welcome!

      In conversation about 9 months ago permalink

      Attachments

      1. No result found on File_thumbnail lookup.
        t.co / Twitter
      2. No result found on File_thumbnail lookup.
        Schema.org - Schema.org
        Schema.org is a set of extensible schemas that enables webmasters to embed structured data on their web pages for use by search engines and other applications.

Feeds

  • Activity Streams
  • RSS 2.0
  • Atom
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.