{"id":23159782,"url":"https://github.com/edent/tweet2embed","last_synced_at":"2025-10-19T09:02:02.823Z","repository":{"id":252363899,"uuid":"839715525","full_name":"edent/Tweet2Embed","owner":"edent","description":"Convert a public Tweet into embedded semantic HTML","archived":false,"fork":false,"pushed_at":"2024-10-27T22:20:09.000Z","size":72,"stargazers_count":164,"open_issues_count":1,"forks_count":7,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-29T07:02:50.704Z","etag":null,"topics":["html","python","semantic-web","twitter","twitter-api"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edent.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-08T07:24:29.000Z","updated_at":"2025-03-28T00:16:28.000Z","dependencies_parsed_at":"2024-10-27T23:39:23.777Z","dependency_job_id":null,"html_url":"https://github.com/edent/Tweet2Embed","commit_stats":null,"previous_names":["edent/tweet2img","edent/tweet2embed"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edent%2FTweet2Embed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edent%2FTweet2Embed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edent%2FTweet2Embed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edent%2FTweet2Embed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edent","download_url":"https://codeload.github.com/edent/Tweet2Embed/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247305932,"owners_count":20917208,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["html","python","semantic-web","twitter","twitter-api"],"created_at":"2024-12-17T22:48:12.070Z","updated_at":"2025-10-19T09:02:02.746Z","avatar_url":"https://github.com/edent.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tweet2Embed\n\nConvert a public Tweet into either:\n\n* Image \u0026amp; alt text\n* Semantic HTML and CSS\n\nUses Selenium's Webdriver to launch a Firefox or Chrome instance and takes a screenshot. Uses the Twitter embed API to get a copy of the text and any alt text. An HTML representation is copied to the clipboard.\n\n## Features\n\n* 🗣 Avatars inlined as WebP\n* 📸 All attached photos inlined\n* 🎥 Video poster inline, \u003cvideo\u003e to original mp4\n* 🔗 Hyperlinks don't use t.co\n* #️⃣ Hashtags \u0026 @ mentions linked\n* 🔄 Includes reply threads \u0026 quote Tweets\n* 🕰 Semantic time\n* 🔍 Schema.org metadata\n* 🖼 Cards\n* 📊 Polls\n* ♥ , 🔁 \u0026 🗨 counts\n* 📖 Autosubmit the Tweet to Archive.org\n\n## Usage\n\n### tweet2html\n* `python tweet2html.py 123` will get the Tweet with ID 123, create an embedded HTML, and copy it to the clipboard.\n* `--thread` to get a parent or quote tweet\n* `--css` if you want the CSS as well\n* `--pretty` for pretty-printed HTML\n* `--save` save the HTML to a file\n* `--schema` adds Schema.org metadata\n\n#### Typical Output\n\nRun `python tweet2html.py -mtp 671919410630819840` and receive:\n\n```html\n\u003cblockquote class=\"tweet-embed\" id=\"tweet-embed-671919410630819840\" lang=\"en\" itemscope itemtype=\"https://schema.org/SocialMediaPosting\"\u003e\n    \u003cheader class=\"tweet-embed-header\" itemprop=\"author\" itemscope itemtype=\"https://schema.org/Person\"\u003e\n        \u003ca href=\"https://twitter.com/polls\" class=\"tweet-embed-user\" itemprop=\"url\"\u003e\n            \u003cimg class=\"tweet-embed-avatar tweet-embed-avatar-circle\" src=\"data:image/webp;base64,UklGRuwAAABXRUJQVlA4IOAAAABQBgCdASowADAAPrVWpEunJSOhqrqpWOAWiWUAxQaACJBCAEB6EJ7HdwZ7m9AsQTxW+yk80gC5I/REUAD+5Ij/FsUhuZ/jfEF7U+ofYABMBkF4Sc8d827tC2qwG95CN3fVuuFS/uqP/Fwucurp8KcurrXcBQpkUCdvp40Y29kx8lP8Y45C3t4IcJPYcIDFVl5+L1M3426aJn0CIdA27KAZjABt0TDw3lgHKggxpvOpEjEgBMnQHzq9rFumwbXgCzvqgOwsseDr6msoySerlXwDZWfNYqz4k58dV2tZoAAAAA==\" alt=\"\" itemprop=\"image\"\u003e\n            \u003cdiv class=\"tweet-embed-user-names\"\u003e\n                \u003cp class=\"tweet-embed-user-names-name\" itemprop=\"name\"\u003epolls\u003c/p\u003e@polls\n            \u003c/div\u003e\n        \u003c/a\u003e\n        \u003cimg class=\"tweet-embed-logo\" alt=\"\" src='data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCmFyaWEtbGFiZWw9IlR3aXR0ZXIiIHJvbGU9ImltZyIKdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoCmQ9Im0wIDBINTEyVjUxMkgwIgpmaWxsPSIjZmZmIi8+PHBhdGggZmlsbD0iIzFkOWJmMCIgZD0ibTQ1OCAxNDBxLTIzIDEwLTQ1IDEyIDI1LTE1IDM0LTQzLTI0IDE0LTUwIDE5YTc5IDc5IDAgMDAtMTM1IDcycS0xMDEtNy0xNjMtODNhODAgODAgMCAwMDI0IDEwNnEtMTcgMC0zNi0xMHMtMyA2MiA2NCA3OXEtMTkgNS0zNiAxczE1IDUzIDc0IDU1cS01MCA0MC0xMTcgMzNhMjI0IDIyNCAwIDAwMzQ2LTIwMHEyMy0xNiA0MC00MSIvPjwvc3ZnPg=='\u003e\n    \u003c/header\u003e\n    \u003csection class=\"tweet-embed-text\" itemprop=\"articleBody\"\u003e\n        The Beatles or The Rolling Stones?\n        \u003chr class=\"tweet-embed-hr\"\u003e\n        \u003clabel for=\"poll_1_count\"\u003eThe Beatles: (28,857)\u003c/label\u003e\u003cbr\u003e\n        \u003cmeter class=\"tweet-embed-meter\" id=\"poll_1_count\" min=\"0\" max=\"100\" low=\"33\" high=\"66\" value=\"76.1\"\u003e28857\u003c/meter\u003e\u003cbr\u003e\n        \u003clabel for=\"poll_2_count\"\u003eThe Rolling Stones: (9,074)\u003c/label\u003e\u003cbr\u003e\n        \u003cmeter class=\"tweet-embed-meter\" id=\"poll_2_count\" min=\"0\" max=\"100\" low=\"33\" high=\"66\" value=\"23.9\"\u003e9074\u003c/meter\u003e\u003cbr\u003e\n    \u003c/section\u003e\n    \u003chr class=\"tweet-embed-hr\"\u003e\n    \u003cfooter class=\"tweet-embed-footer\"\u003e\n        \u003ca href=\"https://twitter.com/polls/status/671919410630819840\" aria-label=\"113 likes\" class=\"tweet-embed-meta\"\u003e❤️ 113\u003c/a\u003e\n        \u003ca href=\"https://twitter.com/polls/status/671919410630819840\" aria-label=\"38 replies\" class=\"tweet-embed-meta\"\u003e💬 38\u003c/a\u003e\n        \u003ca href=\"https://twitter.com/polls/status/671919410630819840\" aria-label=\"0 retweets\" class=\"tweet-embed-meta\"\u003e🔁 0\u003c/a\u003e\t\t\t\n        \u003ca href=\"https://twitter.com/polls/status/671919410630819840\"\u003e\u003ctime datetime=\"2015-12-02T05:10:45.000Z\" itemprop=\"datePublished\"\u003e05:10 - Wed 02 December 2015\u003c/time\u003e\u003c/a\u003e\n    \u003c/footer\u003e\n\u003c/blockquote\u003e\n```\n\n## tweet2img\n* `python tweet2img.py 123` will get the Tweet with ID 123, save a WebP screenshot, and print out the alt text.\n* `python tweet2img.py 123 --thread` as above, but will include the parent Tweet if this is a reply.\n* Screenshot and alt text are saved in the `output` directory.\n* Clipboard receives a copy of the HTML - including data-encoded image - ready to paste in.\n    * `\u003ca href=\"https://twitter.com/edent/status/123\"\u003e\u003cimg src=\"data:image/webp;base64,Ukl...\" width=\"550\" height=\"439\" alt=\"Screenshot from Twitter. 2022-08-19T13:36:44.000Z. Description.\"/\u003e\u003c/a\u003e`\n\n\n##  Useful Examples\n* `1432768058028875791` Video\n* `1095659600420966400` Reply - parent has image\n* `909106648928718848` Multiple images\n* `1560621791470448642` Quote Tweet\n* `670060095972245504` Poll\n* `83659275024601088` Deleted Tweet\n* `1131218926493413377` Summary Card\n* `1485588404037648389` Reply to a quoted Tweet\n\n## Known bugs:\n\n* Fractional Scaling may produce slightly fuzzy images (Wayland related?)\n* On tweet2img, the alt text contains t.co URls rather than the expanded ones (could use entities?)\n* Only some Twitter Cards are rendered in HTML (are there more?)\n* No Dark Mode (overkill?)\n* Many other things (probably?)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedent%2Ftweet2embed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedent%2Ftweet2embed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedent%2Ftweet2embed/lists"}