feat: fix instagram permission from impressions to views, fix md remover mess up the message
This commit is contained in:
parent
91fa898908
commit
7725c1ce71
|
|
@ -1,4 +1,3 @@
|
|||
import removeMd from 'remove-markdown';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
export const useFormatting = (
|
||||
|
|
@ -23,9 +22,6 @@ export const useFormatting = (
|
|||
if (params.saveBreaklines) {
|
||||
newText = newText.replace('\n', '𝔫𝔢𝔴𝔩𝔦𝔫𝔢');
|
||||
}
|
||||
if (params.removeMarkdown) {
|
||||
newText = removeMd(newText);
|
||||
}
|
||||
newText = newText.replace(/@\w{1,15}/g, function(match) {
|
||||
return `<strong>${match}</strong>`;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -384,13 +384,13 @@ export class InstagramProvider
|
|||
|
||||
const { data, ...all } = await (
|
||||
await this.fetch(
|
||||
`https://graph.facebook.com/v20.0/${id}/insights?metric=follower_count,impressions,reach&access_token=${accessToken}&period=day&since=${since}&until=${until}`
|
||||
`https://graph.facebook.com/v20.0/${id}/insights?metric=follower_count,reach&access_token=${accessToken}&period=day&since=${since}&until=${until}`
|
||||
)
|
||||
).json();
|
||||
|
||||
const { data: data2, ...all2 } = await (
|
||||
await this.fetch(
|
||||
`https://graph.facebook.com/v20.0/${id}/insights?metric_type=total_value&metric=likes,comments,shares,saves,replies&access_token=${accessToken}&period=day&since=${since}&until=${until}`
|
||||
`https://graph.facebook.com/v20.0/${id}/insights?metric_type=total_value&metric=likes,views,comments,shares,saves,replies&access_token=${accessToken}&period=day&since=${since}&until=${until}`
|
||||
)
|
||||
).json();
|
||||
const analytics = [];
|
||||
|
|
|
|||
|
|
@ -145,10 +145,7 @@ export class XProvider extends SocialAbstract implements SocialProvider {
|
|||
await timer(2000);
|
||||
|
||||
await client.v2.tweet({
|
||||
text: removeMd(fields.post.replace('\n', '𝔫𝔢𝔴𝔩𝔦𝔫𝔢')).replace(
|
||||
'𝔫𝔢𝔴𝔩𝔦𝔫𝔢',
|
||||
'\n'
|
||||
),
|
||||
text: fields.post,
|
||||
reply: { in_reply_to_tweet_id: id },
|
||||
});
|
||||
return true;
|
||||
|
|
@ -297,10 +294,7 @@ export class XProvider extends SocialAbstract implements SocialProvider {
|
|||
|
||||
// @ts-ignore
|
||||
const { data }: { data: { id: string } } = await client.v2.tweet({
|
||||
text: removeMd(post.message.replace('\n', '𝔫𝔢𝔴𝔩𝔦𝔫𝔢')).replace(
|
||||
'𝔫𝔢𝔴𝔩𝔦𝔫𝔢',
|
||||
'\n'
|
||||
),
|
||||
text: post.message,
|
||||
...(media_ids.length ? { media: { media_ids } } : {}),
|
||||
...(ids.length
|
||||
? { reply: { in_reply_to_tweet_id: ids[ids.length - 1].postId } }
|
||||
|
|
|
|||
Loading…
Reference in New Issue