File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed
packages/metascraper-media-provider Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 17
17
"lodash" : " ~4.17.10" ,
18
18
"memoize-one" : " ~4.0.3" ,
19
19
"memoize-token" : " ~1.1.0" ,
20
+ "p-reflect" : " ~1.0.0" ,
20
21
"tunnel" : " 0.0.6" ,
21
22
"youtube-dl" : " ~1.12.2"
22
23
},
Original file line number Diff line number Diff line change 2
2
3
3
const memoizeToken = require ( 'memoize-token' )
4
4
const { get, chain } = require ( 'lodash' )
5
+ const pReflect = require ( 'p-reflect' )
5
6
const tunnel = require ( 'tunnel' )
6
7
const { URL } = require ( 'url' )
7
8
const got = require ( 'got' )
@@ -55,13 +56,17 @@ const getTwitterInfo = ({ getToken }) => async url => {
55
56
const tweetId = getTweetId ( url )
56
57
const apiUrl = `https://api.twitter.com/2/timeline/conversation/${ tweetId } .json?tweet_mode=extended`
57
58
const guestToken = await getToken ( url )
58
- const { body } = await got ( apiUrl , {
59
- json : true ,
60
- headers : {
61
- authorization : TWITTER_BEARER_TOKEN ,
62
- 'x-guest-token' : guestToken
63
- }
64
- } )
59
+ const res = await pReflect (
60
+ got ( apiUrl , {
61
+ json : true ,
62
+ headers : {
63
+ authorization : TWITTER_BEARER_TOKEN ,
64
+ 'x-guest-token' : guestToken
65
+ }
66
+ } )
67
+ )
68
+
69
+ const body = get ( res , 'value.body' )
65
70
66
71
const id = get (
67
72
body ,
You can’t perform that action at this time.
0 commit comments