@@ -11,7 +11,8 @@ The generators are not a comprehensive match of the API. However, they are enoug
1111Produces a random X user based on X's v2 API:
1212
1313``` ruby
14- Faker ::X .user => {
14+ Faker ::X .user =>
15+ {
1516 data: [
1617 {
1718 author_id: " 5688134805624042468" ,
@@ -67,83 +68,121 @@ Example outputs:
6768``` ruby
6869Faker ::X .tweet =>
6970{
70- data: [
71- {
72- id: " 7999525033982409544" ,
73- text: " Molestias non possimus voluptatem." ,
74- lang: " VA" ,
75- conversation_id: " 7999525033982409544" ,
76- created_at: " 2011-03-16T00:00:00+00:00" ,
77- public_metrics: {retweet_count: 69 , reply_count: 17 , like_count: 21 , quote_count: 8 },
78- possibly_sensitive: false ,
79- entities: {
80- url: { urls: [{url: " https://t.co/gz4z8dvybe" , expanded_url: " http://example.com/salley.grant" , display_url: " example.com/salley.grant" }] },
81- description: { hashtags: [{tag: " Veritatis" }] }
82- },
83- in_reply_to_user_id: false
71+ data: [{
72+ id: " 5530076569335337477" ,
73+ text: " Omnis facere ullam velit." ,
74+ lang: " ja" ,
75+ conversation_id: " 5530076569335337477" ,
76+ created_at: " 2009-02-21T07:00:00.000Z" ,
77+ author_id: " 2788144046134446176" ,
78+ public_metrics: {
79+ retweet_count: 95 ,
80+ reply_count: 3 ,
81+ like_count: 10 ,
82+ quote_count: 3
83+ },
84+ possibly_sensitive: false ,
85+ entities: {
86+ urls: [{
87+ start: 0 ,
88+ end: 5 ,
89+ url: " https://t.co/t6o3lav9z1" ,
90+ expanded_url: " http://example.com/errol.upton" ,
91+ display_url: " example.com/errol.upton"
92+ }],
93+ hashtags: [{
94+ start: 0 ,
95+ end: 5 ,
96+ tag: " Odit"
97+ }]
8498 }
85- ]
99+ } ]
86100}
87101```
88102
89103With additional fields:
90104
91105``` ruby
92106Faker ::X .tweet(include_media: true , include_user: true ) =>
93-
94107{
95- data: [
96- {
97- id: " 8194812886422142201" ,
98- text: " Eos sed quibusdam aperiam." ,
99- lang: " AU" ,
100- conversation_id: " 8194812886422142201" ,
101- created_at: " 2017-10-24T00:00:00+00:00" ,
102- public_metrics: {retweet_count: 87 , reply_count: 19 , like_count: 14 , quote_count: 4 },
103- possibly_sensitive: false ,
104- entities: {
105- url: { urls: [{url: " https://t.co/h9pi5f7q7j" , expanded_url: " http://example.com/angelica_moore" , display_url: " example.com/angelica_moore" }] },
106- description: { hashtags: [{tag: " Saepe" }] }
107- },
108- in_reply_to_user_id: false },
109- { attachments: {media_keys: [" 466995304449852781" ]}
108+ data: [{
109+ id: " 5340086698567112794" ,
110+ text: " Esse nulla minus qui." ,
111+ lang: " en" ,
112+ conversation_id: " 5340086698567112794" ,
113+ created_at: " 2009-07-04T06:00:00.000Z" ,
114+ author_id: " 5156189524741091965" ,
115+ public_metrics: {
116+ retweet_count: 56 ,
117+ reply_count: 2 ,
118+ like_count: 23 ,
119+ quote_count: 1
120+ },
121+ possibly_sensitive: false ,
122+ entities: {
123+ urls: [{
124+ start: 0 ,
125+ end: 5 ,
126+ url: " https://t.co/mqplf9rhpn" ,
127+ expanded_url: " http://example.com/mohamed_koelpin" ,
128+ display_url: " example.com/mohamed_koelpin"
129+ }],
130+ hashtags: [{
131+ start: 0 ,
132+ end: 5 ,
133+ tag: " Atque"
134+ }]
135+ },
136+ attachments: {
137+ media_keys: [" 6992225089295851582" ]
110138 }
111- ],
112- includes: {
113- media: [
114- {
115- type: " photo" ,
116- indices: [103 , 126 ],
117- height: 446 ,
118- media_key: " 466995304449852781" ,
119- preview_image_url: " https://loremflickr.com/1064/600" ,
120- width: 1321 ,
121- url: " https://t.co/s3j25etwdj" ,
122- expanded_url: " https://loremflickr.com/1064/600" ,
123- display_url: " loremflickr.com/1064/600" ,
124- alt_text: " Et possimus repudiandae tenetur."
125- }
126- ],
127- users: [
128- {
129- public_metrics: {followers_count: 488 , following_count: 180 , tweet_count: 6368 , listed_count: 209 },
130- username: " shante" ,
131- pinned_tweet_id: " 7350697183426089357" ,
132- entities: {
133- url: { urls: [{url: " https://t.co/cxwehs7i1z" , expanded_url: " http://example.com/kirstie.reilly" , display_url: " example.com/kirstie.reilly" }] },
134- description: { hashtags: [{tag: " Rem" }] }
139+ }],
140+ includes: {
141+ media: [{
142+ height: 526 ,
143+ media_key: " 6992225089295851582" ,
144+ type: " photo" ,
145+ preview_image_url: " https://loremflickr.com/1064/600" ,
146+ width: 1571 ,
147+ alt_text: " Qui ratione magnam et."
148+ }],
149+ users: [{
150+ public_metrics: {
151+ followers_count: 467 ,
152+ following_count: 3 ,
153+ tweet_count: 9006 ,
154+ listed_count: 984
155+ },
156+ username: " gayle" ,
157+ pinned_tweet_id: " 2282479924658708548" ,
158+ entities: {
159+ url: {
160+ urls: [{
161+ start: 0 ,
162+ end: 5 ,
163+ url: " https://t.co/69eytnuwwu" ,
164+ expanded_url: " http://example.com/werner" ,
165+ display_url: " example.com/werner"
166+ }]
135167 },
136- description: " Ipsa nihil velit adipisci." ,
137- name: " Jerome Heathcote III" ,
138- verified: false ,
139- location: " 222.70.154.120" ,
140- id: " 5679269981284870916" ,
141- protected: false ,
142- url: " https://t.co/5xyjlv6ckv" ,
143- profile_image_url: " https://robohash.org/4106878141532070549.png?size=48x48&set=set1" ,
144- created_at: " 2019-01-27T00:00:00+00:00"
145- }
146- ]
168+ description: {
169+ hashtags: [{
170+ start: 0 ,
171+ end: 5 ,
172+ tag: " Soluta"
173+ }]
174+ }
175+ },
176+ description: " Esse harum voluptatem voluptate." ,
177+ name: " Elva Spinka" ,
178+ verified: false ,
179+ location: " 34.230.131.77" ,
180+ id: " 2365736908578621112" ,
181+ protected: false ,
182+ url: " https://t.co/pyuqky3gdl" ,
183+ profile_image_url: " https://robohash.org/2204799175591912732.png?size=48x48&set=set1" ,
184+ created_at: " 2025-01-30T07:00:00.000Z"
185+ }]
147186 }
148187}
149188```
@@ -153,7 +192,7 @@ Faker::X.tweet(include_media: true, include_user: true) =>
153192Produces a random screen_name:
154193
155194``` ruby
156- Faker ::Twitter .screen_name # => "audreanne_hackett"
195+ Faker ::X .screen_name # => "audreanne_hackett"
157196```
158197
159198# Faker::Twitter
0 commit comments