Skip to content

Commit 90f723e

Browse files
committed
Fixing stuff
1 parent 38844ca commit 90f723e

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ When setting `extract_referenced_posts` to `True` it will instead return a list
265265
* **locale** *(pytz.timezone as str, optional)*: timezone used to convert dates. If not given, will default to UTC.
266266
* **extract_referenced_posts** *(bool, optional)*: whether to return in the output, in addition to the tweet to be normalized, also normalized data for each other referenced tweets found in the payload data (including retweeted and quoted tweets). If `False`, the function will return a `dict`, if `True` a `list` of `dict`. Defaults to `False`.
267267
* **collection_source** *(string, optional)*: An optional information to add within the `collected_via` field of the normalized tweet to indicate whence it was collected.
268-
* **source_version** *(str, optional)*: version of the Twitter payload. Default to "v1".
268+
* **source_version** *(str, optional)*: version of the Twitter payload. Must be either "v1" or "iframe". Default to "v1".
269269

270270
### normalize_tweets_payload_v2
271271

twitwi/normalizers.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def nostr_field(f):
135135
"created_at",
136136
]
137137

138-
USER_META_FIELDS_iframe = [
138+
USER_META_FIELDS_IFRAME = [
139139
"screen_name",
140140
"name",
141141
"verified",
@@ -168,7 +168,7 @@ def grab_extra_meta(source, result, locale=None, source_version: str = "v1"):
168168
if source_version == "v1":
169169
user_meta_field_to_use = USER_META_FIELDS
170170
elif source_version == "iframe":
171-
user_meta_field_to_use = USER_META_FIELDS_iframe
171+
user_meta_field_to_use = USER_META_FIELDS_IFRAME
172172
else:
173173
raise TwitwiError("source_version should be one of v1 or iframe")
174174

@@ -257,7 +257,8 @@ def normalize_tweet(
257257
was collected. Defaults to `None`.
258258
pure (bool, optional): whether to allow the function to mutate its
259259
original argument. Default to `True`.
260-
source_version (str, optional): version of the Twitter payload. Default to "v1".
260+
source_version (str, optional): version of the Twitter payload. Must be
261+
either "v1" or "iframe". Default to "v1".
261262
262263
Returns:
263264
(dict or list): Either a single tweet dict or a list of tweet dicts if
@@ -266,8 +267,8 @@ def normalize_tweet(
266267
"""
267268

268269
# iframe is for the method without api key (here https://shkspr.mobi/blog/2025/04/you-dont-need-an-api-key-to-archive-twitter-data/)
269-
if source_version not in ["v1", "iframe", "bluesky"]:
270-
raise Exception("source should be one of v1, iframe or bluesky")
270+
if source_version not in ["v1", "iframe"]:
271+
raise Exception("source should be one of v1 or iframe")
271272

272273
if pure:
273274
tweet = deepcopy(tweet)

0 commit comments

Comments
 (0)