Skip to content

Commit 4ed14fa

Browse files
committed
sed s/twitter.com/x.com/g
1 parent 8f9c86d commit 4ed14fa

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

mautrix_twitter/commands/auth.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ async def login_cookie(evt: CommandEvent) -> None:
3737
"auth_token": None,
3838
}
3939
await evt.reply(
40-
"1. Log in to [Twitter](https://www.twitter.com/) in a private/incognito window.\n"
40+
"1. Log in to [Twitter](https://www.x.com/) in a private/incognito window.\n"
4141
"2. Press `F12` to open developer tools.\n"
4242
'3. Select the "Application" (Chrome) or "Storage" (Firefox) tab.\n'
43-
'4. In the sidebar, expand "Cookies" and select `https://twitter.com`.\n'
43+
'4. In the sidebar, expand "Cookies" and select `https://x.com`.\n'
4444
"5. In the cookie list, find the `auth_token` row and double click on the value"
4545
r", then copy the value and send it here."
4646
)

mautrix_twitter/commands/conn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ async def ping(evt: CommandEvent) -> None:
4545
user_info = await evt.sender.get_info()
4646
await evt.reply(
4747
f"You're logged in as {user_info.name} "
48-
f"([@{evt.sender.username}](https://twitter.com/{evt.sender.username}), "
48+
f"([@{evt.sender.username}](https://x.com/{evt.sender.username}), "
4949
f"user ID: {evt.sender.twid})"
5050
)
5151

mautrix_twitter/portal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ def deterministic_event_id(self, msg_id: str, part: str) -> EventID:
485485
hash_content = f"{self.mxid}/twitter/{msg_id}/{part}"
486486
hashed = hashlib.sha256(hash_content.encode("utf-8")).digest()
487487
b64hash = base64.urlsafe_b64encode(hashed).decode("utf-8").rstrip("=")
488-
return EventID(f"${b64hash}:twitter.com")
488+
return EventID(f"${b64hash}:x.com")
489489

490490
async def _convert_twitter_message(
491491
self, source: u.User, sender: p.Puppet, message: MessageData

mautwitdm/streamer.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ class TwitterStreamer(TwitterDispatcher):
2525
via ``/live_pipeline/events``.
2626
"""
2727

28-
pipeline_url = URL("https://api.twitter.com/live_pipeline/events")
29-
pipeline_update_url = URL("https://api.twitter.com/1.1/live_pipeline/update_subscriptions")
28+
pipeline_url = URL("https://api.x.com/live_pipeline/events")
29+
pipeline_update_url = URL("https://api.x.com/1.1/live_pipeline/update_subscriptions")
3030

3131
log: logging.Logger
3232
loop: asyncio.AbstractEventLoop
@@ -44,8 +44,8 @@ async def _stream(self) -> AsyncGenerator[StreamEvent, None]:
4444
"Accept": "text/event-stream",
4545
"Accept-Language": "en-US,en;q=0.5",
4646
"DNT": "1",
47-
"Origin": "https://twitter.com",
48-
"Referer": "https://twitter.com/messages",
47+
"Origin": "https://x.com",
48+
"Referer": "https://x.com/messages",
4949
"Pragma": "no-cache",
5050
}
5151
empty_bytes = b""

mautwitdm/twitter.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
Tokens = NamedTuple("Tokens", auth_token=str, csrf_token=str)
2626
DownloadResp = NamedTuple("DownloadResp", data=bytes, mime_type=str)
2727

28-
twitter_com = URL("https://twitter.com/")
28+
twitter_com = URL("https://x.com/")
2929

3030

3131
class TwitterAPI(TwitterUploader, TwitterStreamer, TwitterPoller):
3232
"""The main entrypoint for using the internal Twitter DM API."""
3333

34-
base_url: URL = URL("https://api.twitter.com/1.1")
34+
base_url: URL = URL("https://api.x.com/1.1")
3535
dm_url: URL = base_url / "dm"
3636

3737
loop: asyncio.AbstractEventLoop
@@ -76,9 +76,9 @@ def set_tokens(self, auth_token: str, csrf_token: str) -> None:
7676
"""
7777
cookie = SimpleCookie()
7878
cookie["auth_token"] = auth_token
79-
cookie["auth_token"].update({"domain": "twitter.com", "path": "/"})
79+
cookie["auth_token"].update({"domain": "x.com", "path": "/"})
8080
cookie["ct0"] = csrf_token
81-
cookie["ct0"].update({"domain": "twitter.com", "path": "/"})
81+
cookie["ct0"].update({"domain": "x.com", "path": "/"})
8282
self.http.cookie_jar.update_cookies(cookie, twitter_com)
8383

8484
def mark_typing(self, conversation_id: str | None) -> None:
@@ -93,7 +93,7 @@ def mark_typing(self, conversation_id: str | None) -> None:
9393

9494
@property
9595
def tokens(self) -> Tokens | None:
96-
cookies = self.http.cookie_jar.filter_cookies(URL("https://twitter.com/"))
96+
cookies = self.http.cookie_jar.filter_cookies(URL("https://x.com/"))
9797
try:
9898
return Tokens(auth_token=cookies["auth_token"].value, csrf_token=cookies["ct0"].value)
9999
except KeyError:
@@ -118,8 +118,8 @@ def headers(self) -> dict[str, str]:
118118
"Accept": "*/*",
119119
"Accept-Language": "en-US,en;q=0.5",
120120
"DNT": "1",
121-
"Origin": "https://twitter.com",
122-
"Referer": "https://twitter.com/messages",
121+
"Origin": "https://x.com",
122+
"Referer": "https://x.com/messages",
123123
"x-twitter-auth-type": "OAuth2Session",
124124
"x-twitter-client-language": "en",
125125
"x-twitter-active-user": "yes",
@@ -130,7 +130,7 @@ async def download_media(self, url: str) -> DownloadResp:
130130
headers = {
131131
"Accept": "*/*",
132132
"DNT": "1",
133-
"Referer": "https://twitter.com/messages",
133+
"Referer": "https://x.com/messages",
134134
"User-Agent": self.user_agent,
135135
}
136136
async with self.http.get(url, headers=headers) as resp:

mautwitdm/uploader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818

1919
class TwitterUploader:
20-
upload_url: URL = URL("https://upload.twitter.com/i/media/upload.json")
20+
upload_url: URL = URL("https://upload.x.com/i/media/upload.json")
2121

2222
http: ClientSession
2323
log: logging.Logger

0 commit comments

Comments
 (0)