{"id":19797098,"url":"https://github.com/joom/twitter-timeline-scraper","last_synced_at":"2025-08-25T05:06:45.391Z","repository":{"id":14469787,"uuid":"17181792","full_name":"joom/twitter-timeline-scraper","owner":"joom","description":"Scraper for Twitter embedded timelines.","archived":false,"fork":false,"pushed_at":"2014-12-21T11:29:17.000Z","size":142,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-01T03:36:18.165Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-02-25T17:32:26.000Z","updated_at":"2020-12-21T01:45:57.000Z","dependencies_parsed_at":"2022-07-10T06:02:33.124Z","dependency_job_id":null,"html_url":"https://github.com/joom/twitter-timeline-scraper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/joom/twitter-timeline-scraper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joom%2Ftwitter-timeline-scraper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joom%2Ftwitter-timeline-scraper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joom%2Ftwitter-timeline-scraper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joom%2Ftwitter-timeline-scraper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joom","download_url":"https://codeload.github.com/joom/twitter-timeline-scraper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joom%2Ftwitter-timeline-scraper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272008760,"owners_count":24857658,"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","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-12T07:23:45.545Z","updated_at":"2025-08-25T05:06:45.335Z","avatar_url":"https://github.com/joom.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"twitter-timeline-scraper\n========================\n\nJavaScript scraper for Twitter embedded timelines.\n\nWhen you copy and paste the code you get from Twitter, you have to replace this:\n```html\n\u003cscript\u003e!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+\"://platform.twitter.com/widgets.js\";fjs.parentNode.insertBefore(js,fjs);}}(document,\"script\",\"twitter-wjs\");\u003c/script\u003e\n\n```\n... with this, in order to have an onTimelineRender event:\n```html\n\u003cscript\u003e!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+\"://platform.twitter.com/widgets.js\";js.setAttribute('onload', \"twttr.events.bind('rendered',function(e) {Timeline.onLoad(e)});\");fjs.parentNode.insertBefore(js,fjs);}}(document,\"script\",\"twitter-wjs\");\u003c/script\u003e\n\n```\nIn order to get the the serialized object, you need to call Timeline.serialize, and pass the iframe created by the embedded timeline as a parameter to that function. If you don't want to deal with that, adding an event to listen for onTimelineRender should work better for you:\n```javascript\ndocument.addEventListener('onTimelineRender', function(e) {\n\tvar data = Timeline.serialize(e.detail.timeline);\n\tconsole.log(data);\n});\n```\nYou can see the example.html file to see how it is used.\n\nExample output is in this format:\n```json\n{\n    \"id\": \"439123783694028800\",\n    \"user\": {\n        \"name\": \"Alex Sexton\",\n        \"username\": \"SlexAxton\",\n        \"avatar\": {\n            \"x1\": \"https://pbs.twimg.com/profile_images/378800000335373005/bfe543e85a3f28e646543a14208a865a_normal.jpeg\",\n            \"x2\": \"https://pbs.twimg.com/profile_images/378800000335373005/bfe543e85a3f28e646543a14208a865a_bigger.jpeg\"\n        }\n    },\n    \"text\": \"JavaScript: The Good Farts.\\n\\n(I've been holding on to this tweet for 22 months)\",\n    \"time\": \"2014-02-27T19:44:03.000Z\",\n    \"url\": \"https://twitter.com/SlexAxton/statuses/439123783694028800\",\n    \"stats\": {\n        \"rt\": 51,\n        \"fav\": 46\n    },\n    \"retweeted\": true,\n    \"photo\": false,\n    \"playable\": false\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoom%2Ftwitter-timeline-scraper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoom%2Ftwitter-timeline-scraper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoom%2Ftwitter-timeline-scraper/lists"}