feat: twitter.com -> x.com
This commit is contained in:
parent
b3845b678b
commit
78f3cb3f75
|
|
@ -30,5 +30,3 @@ package-lock.json
|
|||
# pnpm-lock.yaml
|
||||
yarn.lock
|
||||
yarn-error.log
|
||||
|
||||
scripts/twitter-token/accounts.*
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
[](https://github.com/DIYgod/RSSHub/actions/workflows/test.yml?query=event%3Apush+branch%3Amaster)
|
||||
[](https://app.codecov.io/gh/DIYgod/RSSHub/branch/master)
|
||||
|
||||
[](https://t.me/rsshub) [](https://t.me/awesomeRSSHub) [](https://twitter.com/intent/follow?screen_name=_RSSHub)
|
||||
[](https://t.me/rsshub) [](https://t.me/awesomeRSSHub) [](https://x.com/intent/follow?screen_name=_RSSHub)
|
||||
|
||||
## Introduction
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ RSSHub delivers millions of contents aggregated from all kinds of sources, our v
|
|||
|
||||
RSSHub can be used with browser extension [RSSHub Radar](https://github.com/DIYgod/RSSHub-Radar) and mobile auxiliary app [RSSBud](https://github.com/Cay-Zhang/RSSBud) (iOS) and [RSSAid](https://github.com/LeetaoGoooo/RSSAid) (Android)
|
||||
|
||||
[English docs](https://docs.rsshub.app) | [Telegram Group](https://t.me/rsshub) | [Telegram Channel](https://t.me/awesomeRSSHub) | [Twitter](https://twitter.com/intent/follow?screen_name=_RSSHub) | [中文文档](https://docs.rsshub.app/zh/)
|
||||
[English docs](https://docs.rsshub.app) | [Telegram Group](https://t.me/rsshub) | [Telegram Channel](https://t.me/awesomeRSSHub) | [Twitter](https://x.com/intent/follow?screen_name=_RSSHub) | [中文文档](https://docs.rsshub.app/zh/)
|
||||
|
||||
## Special Thanks
|
||||
|
||||
|
|
@ -91,4 +91,4 @@ Open source is a very expensive thing. RSSHub would not be possible without the
|
|||
**RSSHub** © [DIYgod](https://github.com/DIYgod), Released under the [MIT](./LICENSE) License.<br>
|
||||
Authored and maintained by DIYgod with help from contributors ([list](https://github.com/DIYgod/RSSHub/contributors)).
|
||||
|
||||
> Blog [@DIYgod](https://diygod.cc) · GitHub [@DIYgod](https://github.com/DIYgod) · Twitter [@DIYgod](https://twitter.com/DIYgod) · Telegram Channel [@awesomeDIYgod](https://t.me/awesomeDIYgod)
|
||||
> Blog [@DIYgod](https://diygod.cc) · GitHub [@DIYgod](https://github.com/DIYgod) · Twitter [@DIYgod](https://x.com/DIYgod) · Telegram Channel [@awesomeDIYgod](https://t.me/awesomeDIYgod)
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ const handler = async (ctx) => {
|
|||
|
||||
return {
|
||||
title: `Twitter Keyword - ${keyword}`,
|
||||
link: `https://twitter.com/search?q=${encodeURIComponent(keyword)}`,
|
||||
link: `https://x.com/search?q=${encodeURIComponent(keyword)}`,
|
||||
item: utils.ProcessFeed(ctx, {
|
||||
data: data.statuses,
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ const handler = async (ctx) => {
|
|||
|
||||
return {
|
||||
title: `Twitter @${userInfo.name}`,
|
||||
link: `https://twitter.com/${screen_name}`,
|
||||
link: `https://x.com/${screen_name}`,
|
||||
image: profileImageUrl,
|
||||
description: userInfo.description,
|
||||
item: utils.ProcessFeed(ctx, {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ const twitterGot = async (url, params) => {
|
|||
connection: 'keep-alive',
|
||||
'content-type': 'application/json',
|
||||
'x-twitter-active-user': 'yes',
|
||||
authority: 'api.twitter.com',
|
||||
authority: 'api.x.com',
|
||||
'accept-encoding': 'gzip',
|
||||
'accept-language': 'en-US,en;q=0.9',
|
||||
accept: '*/*',
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const baseUrl = 'https://api.twitter.com';
|
||||
const baseUrl = 'https://api.x.com';
|
||||
|
||||
const consumerKey = '3nVuSoBZnx6U4vzUxf5w';
|
||||
const consumerSecret = 'Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys';
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ async function login() {
|
|||
headers['x-guest-token'] = guestToken.data.guest_token;
|
||||
|
||||
const task1 = await ofetch.raw(
|
||||
'https://api.twitter.com/1.1/onboarding/task.json?' +
|
||||
'https://api.x.com/1.1/onboarding/task.json?' +
|
||||
new URLSearchParams({
|
||||
flow_name: 'login',
|
||||
api_version: '1',
|
||||
|
|
@ -84,7 +84,7 @@ async function login() {
|
|||
|
||||
headers.att = task1.headers.get('att');
|
||||
|
||||
const task2 = await got.post('https://api.twitter.com/1.1/onboarding/task.json', {
|
||||
const task2 = await got.post('https://api.x.com/1.1/onboarding/task.json', {
|
||||
headers,
|
||||
json: {
|
||||
flow_token: task1._data.flow_token,
|
||||
|
|
@ -102,7 +102,7 @@ async function login() {
|
|||
});
|
||||
logger.debug('Twitter login 3 finished: LoginEnterUserIdentifier.');
|
||||
|
||||
const task3 = await got.post('https://api.twitter.com/1.1/onboarding/task.json', {
|
||||
const task3 = await got.post('https://api.x.com/1.1/onboarding/task.json', {
|
||||
headers,
|
||||
json: {
|
||||
flow_token: task2.data.flow_token,
|
||||
|
|
@ -119,7 +119,7 @@ async function login() {
|
|||
});
|
||||
logger.debug('Twitter login 4 finished: LoginEnterPassword.');
|
||||
|
||||
const task4 = await got.post('https://api.twitter.com/1.1/onboarding/task.json', {
|
||||
const task4 = await got.post('https://api.x.com/1.1/onboarding/task.json', {
|
||||
headers,
|
||||
json: {
|
||||
flow_token: task3.data.flow_token,
|
||||
|
|
@ -142,7 +142,7 @@ async function login() {
|
|||
} else if (subtask.subtask_id === 'LoginTwoFactorAuthChallenge') {
|
||||
const token = authenticator.generate(authenticationSecret);
|
||||
|
||||
const task5 = await got.post('https://api.twitter.com/1.1/onboarding/task.json', {
|
||||
const task5 = await got.post('https://api.x.com/1.1/onboarding/task.json', {
|
||||
headers,
|
||||
json: {
|
||||
flow_token: task4.data.flow_token,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const baseUrl = 'https://twitter.com/i/api';
|
||||
const baseUrl = 'https://x.com/i/api';
|
||||
|
||||
const graphQLEndpointsPlain = [
|
||||
'/graphql/eS7LO5Jy3xgmd3dbL044EA/UserTweets',
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ export const twitterGot = async (url, params) => {
|
|||
url: `${url}?${queryString.stringify(params)}`,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
authority: 'twitter.com',
|
||||
authority: 'x.com',
|
||||
accept: '*/*',
|
||||
'accept-language': 'en-US,en;q=0.9',
|
||||
authorization: bearerToken,
|
||||
|
|
@ -32,7 +32,7 @@ export const twitterGot = async (url, params) => {
|
|||
cookie: config.twitter.cookie,
|
||||
dnt: '1',
|
||||
pragma: 'no-cache',
|
||||
referer: 'https://twitter.com/narendramodi',
|
||||
referer: 'https://x.com/narendramodi',
|
||||
'x-csrf-token': jsonCookie.ct0,
|
||||
'x-twitter-active-user': 'yes',
|
||||
'x-twitter-auth-type': 'OAuth2Session',
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ export const route: Route = {
|
|||
handler,
|
||||
radar: [
|
||||
{
|
||||
source: ['twitter.com/home'],
|
||||
source: ['x.com/home'],
|
||||
target: '/home',
|
||||
},
|
||||
],
|
||||
|
|
@ -51,7 +51,7 @@ async function handler(ctx) {
|
|||
|
||||
return {
|
||||
title: `Twitter following timeline`,
|
||||
link: `https://twitter.com/home`,
|
||||
link: `https://x.com/home`,
|
||||
// description: userInfo?.description,
|
||||
item: utils.ProcessFeed(ctx, {
|
||||
data,
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ export const route: Route = {
|
|||
handler,
|
||||
radar: [
|
||||
{
|
||||
source: ['twitter.com/search'],
|
||||
source: ['x.com/search'],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
@ -45,7 +45,7 @@ async function handler(ctx) {
|
|||
|
||||
return {
|
||||
title: `Twitter Keyword - ${keyword}`,
|
||||
link: `https://twitter.com/search?q=${encodeURIComponent(keyword)}`,
|
||||
link: `https://x.com/search?q=${encodeURIComponent(keyword)}`,
|
||||
item: utils.ProcessFeed(ctx, {
|
||||
data,
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ async function handler(ctx) {
|
|||
|
||||
return {
|
||||
title: `Twitter Likes - ${id}`,
|
||||
link: `https://twitter.com/${id}/likes`,
|
||||
link: `https://x.com/${id}/likes`,
|
||||
item: utils.ProcessFeed(ctx, {
|
||||
data,
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ export const route: Route = {
|
|||
handler,
|
||||
radar: [
|
||||
{
|
||||
source: ['twitter.com/i/lists/:id'],
|
||||
source: ['x.com/i/lists/:id'],
|
||||
target: '/list/:id',
|
||||
},
|
||||
],
|
||||
|
|
@ -49,7 +49,7 @@ async function handler(ctx) {
|
|||
|
||||
return {
|
||||
title: `Twitter List - ${id}`,
|
||||
link: `https://twitter.com/i/lists/${id}`,
|
||||
link: `https://x.com/i/lists/${id}`,
|
||||
item: utils.ProcessFeed(ctx, {
|
||||
data,
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ export const route: Route = {
|
|||
handler,
|
||||
radar: [
|
||||
{
|
||||
source: ['twitter.com/:id/media'],
|
||||
source: ['x.com/:id/media'],
|
||||
target: '/media/:id',
|
||||
},
|
||||
],
|
||||
|
|
@ -51,7 +51,7 @@ async function handler(ctx) {
|
|||
|
||||
return {
|
||||
title: `Twitter @${userInfo?.name}`,
|
||||
link: `https://twitter.com/${userInfo?.screen_name}/media`,
|
||||
link: `https://x.com/${userInfo?.screen_name}/media`,
|
||||
image: profileImageUrl.replace(/_normal.jpg$/, '.jpg'),
|
||||
description: userInfo?.description,
|
||||
item: utils.ProcessFeed(ctx, {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import type { Namespace } from '@/types';
|
||||
|
||||
export const namespace: Namespace = {
|
||||
name: 'Twitter',
|
||||
url: 'twitter.com',
|
||||
name: 'X (Twitter)',
|
||||
url: 'x.com',
|
||||
description: `Specify options (in the format of query string) in parameter \`routeParams\` to control some extra features for Tweets
|
||||
|
||||
| Key | Description | Accepts | Defaults to |
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ async function handler(ctx) {
|
|||
|
||||
return {
|
||||
title: `Twitter Trends on ${data[0].locations[0].name}`,
|
||||
link: `https://twitter.com/i/trends`,
|
||||
link: `https://x.com/i/trends`,
|
||||
item: trends
|
||||
.filter((t) => !t.promoted_content)
|
||||
.map((t) => ({
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ async function handler(ctx) {
|
|||
|
||||
return {
|
||||
title: `Twitter @${userInfo.name}`,
|
||||
link: `https://twitter.com/${userInfo.screen_name}/status/${status}`,
|
||||
link: `https://x.com/${userInfo.screen_name}/status/${status}`,
|
||||
image: profileImageUrl.replace(/_normal.jpg$/, '.jpg'),
|
||||
description: userInfo.description,
|
||||
item,
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ export const route: Route = {
|
|||
handler,
|
||||
radar: [
|
||||
{
|
||||
source: ['twitter.com/:id'],
|
||||
source: ['x.com/:id'],
|
||||
target: '/user/:id',
|
||||
},
|
||||
],
|
||||
|
|
@ -66,7 +66,7 @@ async function handler(ctx) {
|
|||
|
||||
return {
|
||||
title: `Twitter @${userInfo?.name}`,
|
||||
link: `https://twitter.com/${userInfo?.screen_name}`,
|
||||
link: `https://x.com/${userInfo?.screen_name}`,
|
||||
image: profileImageUrl.replace(/_normal.jpg$/, '.jpg'),
|
||||
description: userInfo?.description,
|
||||
item: utils.ProcessFeed(ctx, {
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
|
|||
let img = '';
|
||||
if (item.extended_entities) {
|
||||
for (const media of item.extended_entities.media) {
|
||||
// https://developer.twitter.com/en/docs/tweets/data-dictionary/overview/extended-entities-object
|
||||
// https://developer.x.com/en/docs/tweets/data-dictionary/overview/extended-entities-object
|
||||
let content = '';
|
||||
let style = '';
|
||||
let originalImg;
|
||||
|
|
@ -211,7 +211,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
|
|||
}
|
||||
|
||||
if (readable) {
|
||||
quote += `<a href='https://twitter.com/${author.screen_name}' target='_blank' rel='noopener noreferrer'>`;
|
||||
quote += `<a href='https://x.com/${author.screen_name}' target='_blank' rel='noopener noreferrer'>`;
|
||||
}
|
||||
|
||||
if (showQuotedAuthorAvatarInDesc) {
|
||||
|
|
@ -244,7 +244,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
|
|||
quoteInTitle += `${author.name}: ${formatText(quoteData)}`;
|
||||
|
||||
if (readable) {
|
||||
quote += `<br><small>Link: <a href='https://twitter.com/${author.screen_name}/status/${quoteData.id_str || quoteData.conversation_id_str}' target='_blank' rel='noopener noreferrer'>https://twitter.com/${
|
||||
quote += `<br><small>Link: <a href='https://x.com/${author.screen_name}/status/${quoteData.id_str || quoteData.conversation_id_str}' target='_blank' rel='noopener noreferrer'>https://x.com/${
|
||||
author.screen_name
|
||||
}/status/${quoteData.id_str || quoteData.conversation_id_str}</a></small>`;
|
||||
}
|
||||
|
|
@ -298,7 +298,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
|
|||
if (showAuthorInDesc) {
|
||||
if (readable) {
|
||||
description += '<small>';
|
||||
description += `<a href='https://twitter.com/${originalItem.user.screen_name}' target='_blank' rel='noopener noreferrer'>`;
|
||||
description += `<a href='https://x.com/${originalItem.user.screen_name}' target='_blank' rel='noopener noreferrer'>`;
|
||||
}
|
||||
if (authorNameBold) {
|
||||
description += `<strong>`;
|
||||
|
|
@ -316,7 +316,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
|
|||
if (!showAuthorInDesc) {
|
||||
description += ' ';
|
||||
if (readable) {
|
||||
description += `<a href='https://twitter.com/${item.user.screen_name}' target='_blank' rel='noopener noreferrer'>`;
|
||||
description += `<a href='https://x.com/${item.user.screen_name}' target='_blank' rel='noopener noreferrer'>`;
|
||||
}
|
||||
if (authorNameBold) {
|
||||
description += `<strong>`;
|
||||
|
|
@ -336,7 +336,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
|
|||
}
|
||||
if (showAuthorInDesc) {
|
||||
if (readable) {
|
||||
description += `<a href='https://twitter.com/${item.user.screen_name}' target='_blank' rel='noopener noreferrer'>`;
|
||||
description += `<a href='https://x.com/${item.user.screen_name}' target='_blank' rel='noopener noreferrer'>`;
|
||||
}
|
||||
|
||||
if (showAuthorAvatarInDesc) {
|
||||
|
|
@ -376,8 +376,8 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
|
|||
const authorName = originalItem.user.name;
|
||||
const link =
|
||||
originalItem.user.screen_name && (originalItem.id_str || originalItem.conversation_id_str)
|
||||
? `https://twitter.com/${originalItem.user.screen_name}/status/${originalItem.id_str || originalItem.conversation_id_str}`
|
||||
: `https://twitter.com/${item.user.screen_name}/status/${item.id_str || item.conversation_id_str}`;
|
||||
? `https://x.com/${originalItem.user.screen_name}/status/${originalItem.id_str || originalItem.conversation_id_str}`
|
||||
: `https://x.com/${item.user.screen_name}/status/${item.id_str || item.conversation_id_str}`;
|
||||
return {
|
||||
title,
|
||||
author: authorName,
|
||||
|
|
@ -396,7 +396,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
|
|||
(item.is_quote_status && {
|
||||
links: [
|
||||
{
|
||||
url: `https://twitter.com/${item.quoted_status?.user?.screen_name}/status/${item.quoted_status?.id_str || item.quoted_status?.conversation_id_str}`,
|
||||
url: `https://x.com/${item.quoted_status?.user?.screen_name}/status/${item.quoted_status?.id_str || item.quoted_status?.conversation_id_str}`,
|
||||
type: 'quote',
|
||||
},
|
||||
],
|
||||
|
|
@ -405,7 +405,7 @@ const ProcessFeed = (ctx, { data = [] }, params = {}) => {
|
|||
item.in_reply_to_status_id_str && {
|
||||
links: [
|
||||
{
|
||||
url: `https://twitter.com/${item.in_reply_to_screen_name}/status/${item.in_reply_to_status_id_str}`,
|
||||
url: `https://x.com/${item.in_reply_to_screen_name}/status/${item.in_reply_to_status_id_str}`,
|
||||
type: 'reply',
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ const Index: FC<{
|
|||
Telegram channel
|
||||
</a>{' '}
|
||||
and{' '}
|
||||
<a target="_blank" href="https://twitter.com/intent/follow?screen_name=_RSSHub" className="text-[#F5712C]">
|
||||
<a target="_blank" href="https://x.com/intent/follow?screen_name=_RSSHub" className="text-[#F5712C]">
|
||||
Twitter
|
||||
</a>{' '}
|
||||
to get community support and news.
|
||||
|
|
@ -96,7 +96,7 @@ const Index: FC<{
|
|||
Telegram 频道
|
||||
</a>
|
||||
和{' '}
|
||||
<a target="_blank" href="https://twitter.com/intent/follow?screen_name=_RSSHub" className="text-[#F5712C]">
|
||||
<a target="_blank" href="https://x.com/intent/follow?screen_name=_RSSHub" className="text-[#F5712C]">
|
||||
Twitter
|
||||
</a>{' '}
|
||||
获取社区支持和新闻。
|
||||
|
|
@ -115,7 +115,7 @@ const Index: FC<{
|
|||
<a target="_blank" href="https://t.me/awesomeRSSHub">
|
||||
<img className="inline" src="https://icons.ly/telegram" alt="telegram channel" width="20" height="20" />
|
||||
</a>
|
||||
<a target="_blank" href="https://twitter.com/intent/follow?screen_name=_RSSHub" className="text-[#F5712C]">
|
||||
<a target="_blank" href="https://x.com/intent/follow?screen_name=_RSSHub" className="text-[#F5712C]">
|
||||
<img className="inline" src="https://icons.ly/twitter" alt="github" width="20" height="20" />
|
||||
</a>
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ const Index: FC<{ debugQuery: string | undefined }> = ({ debugQuery }) => {
|
|||
<a target="_blank" href="https://t.me/awesomeRSSHub">
|
||||
<img className="inline" src="https://icons.ly/telegram" alt="telegram channel" width="20" height="20" />
|
||||
</a>
|
||||
<a target="_blank" href="https://twitter.com/intent/follow?screen_name=_RSSHub" className="text-[#F5712C]">
|
||||
<a target="_blank" href="https://x.com/intent/follow?screen_name=_RSSHub" className="text-[#F5712C]">
|
||||
<img className="inline" src="https://icons.ly/twitter" alt="github" width="20" height="20" />
|
||||
</a>
|
||||
</p>
|
||||
|
|
|
|||
Loading…
Reference in New Issue