crash.software
Projects
Pull Requests
Issues
Builds
snscrape
Code
Files
Commits
Branches
Tags
Pull Requests
Code Comments
Code Compare
Issues
List
Boards
Milestones
Builds
Statistics
Contributions
Source Lines
Child Projects
Projects
STRLCPY
snscrape
Commits
5fc67f2b
🤬
Sign In
Add support for 'message me' cards
JustAnotherArchivist
committed
2 years ago
5fc67f2b
1 parent
65e7d8bd
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
Total 1 files
■ ■ ■ ■ ■ ■
snscrape/modules/twitter.py
skipped 278 lines
279
279
id: str
280
280
281
281
282
+
@dataclasses.dataclass
283
+
class MessageMeCard(Card):
284
+
recipient: 'User'
285
+
url: str
286
+
buttonText: str
287
+
288
+
282
289
UnifiedCardComponentKey = str
283
290
UnifiedCardDestinationKey = str
284
291
UnifiedCardMediumKey = str
skipped 792 lines
1077
1084
return AppPlayerCard(**kwargs)
1078
1085
elif cardName == '3691233323:audiospace':
1079
1086
return SpacesCard(**_kwargs_from_map({'card_url': 'url', 'id': 'id'}))
1087
+
elif cardName == '2586390716:message_me':
1088
+
# Note that the strings in Twitter's JS appear to have an incorrect mapping that then gets changed somewhere in the 1.8 MiB of JS!
1089
+
# cta_1, 3, and 4 should mean 'Message us', 'Send a private message', and 'Send me a private message', but the correct mapping is currently unknown.
1090
+
ctas = {'message_me_card_cta_2': 'Send us a private message'}
1091
+
if bindingValues['cta'] not in ctas:
1092
+
_logger.warning(f'Unsupported message_me card cta on tweet {tweetId}: {bindingValues["cta"]!r}')
1093
+
return
1094
+
return MessageMeCard(**_kwargs_from_map({'recipient': 'recipient', 'card_url': 'url'}), buttonText = ctas[bindingValues['cta']])
1080
1095
elif cardName == 'unified_card':
1081
1096
o = json.loads(bindingValues['unified_card'])
1082
1097
kwargs = {}
skipped 589 lines
All occurrences
Please wait...
Page is in error, reload to recover