-
Notifications
You must be signed in to change notification settings - Fork 15
/
podcastIndex.ts
636 lines (558 loc) · 21.5 KB
/
podcastIndex.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
import axios from 'axios'
import { config } from '~/config'
import { getConnection, getRepository } from 'typeorm'
import { getAuthorityFeedUrlByPodcastIndexId, getFeedUrlByUrl } from '~/controllers/feedUrl'
import { connectToDb } from '~/lib/db'
import { convertPIValueTagToPVValueTagArray } from '~/lib/podcastIndex'
import { parseFeedUrl } from '~/services/parser'
import { addFeedUrlsByPodcastIndexId } from '~/services/queue'
import { request } from '~/lib/request'
import { getPodcastByPodcastIndexId } from '~/controllers/podcast'
import { Podcast } from '~/entities'
import { ValueTagOriginal } from 'podverse-shared'
import { chunkArray } from '~/lib/utility'
const shortid = require('shortid')
const sha1 = require('crypto-js/sha1')
const encHex = require('crypto-js/enc-hex')
const csv = require('csvtojson')
const createError = require('http-errors')
const { podcastIndexConfig, userAgent } = config
/*
NOTE!!!
The episodeGuid needs to be encoded both on the client-side and server side if it is an http url guid.
Koa will automatically decode the encoded url param, and then Podcast Index API needs it
encoded once again before sending the request to PI API.
*/
const axiosRequest = async (url) => {
const apiHeaderTime = new Date().getTime() / 1000
const hash = sha1(config.podcastIndexConfig.authKey + config.podcastIndexConfig.secretKey + apiHeaderTime).toString(
encHex
)
return axios({
url,
method: 'GET',
headers: {
'User-Agent': userAgent,
'X-Auth-Key': podcastIndexConfig.authKey,
'X-Auth-Date': apiHeaderTime,
Authorization: hash
}
})
}
const getValueTagEnabledPodcastIdsFromPIRecursively = async (accumulatedPodcastIndexIds: number[], startAt = 1) => {
const url = `${podcastIndexConfig.baseUrl}/podcasts/bytag?podcast-value=true&max=5000&start_at=${startAt}`
const response = await axiosRequest(url)
const { data } = response
for (const feed of data.feeds) {
accumulatedPodcastIndexIds.push(feed.id)
}
if (data.nextStartAt) {
return await getValueTagEnabledPodcastIdsFromPIRecursively(accumulatedPodcastIndexIds, data.nextStartAt)
}
return accumulatedPodcastIndexIds
}
export const getValueTagEnabledPodcastIdsFromPI = async () => {
const accumulatedPodcastIndexIds = []
const nextStartAt = 1
const podcastIndexIds = await getValueTagEnabledPodcastIdsFromPIRecursively(accumulatedPodcastIndexIds, nextStartAt)
return podcastIndexIds
}
const getRecentlyUpdatedDataRecursively = async (accumulatedFeedData: any[] = [], since?: number) => {
console.log('getRecentlyUpdatedDataRecursively')
console.log('accumulatedFeedData.length', accumulatedFeedData.length)
const currentTime = Math.floor(Date.now() / 1000)
const axiosResponseData = await getRecentlyUpdatedData(since)
const { data, itemCount, nextSince } = axiosResponseData
console.log('itemCount', itemCount)
console.log('since', since)
console.log('nextSince', nextSince)
const { feeds } = data
console.log('feeds', feeds.length)
accumulatedFeedData = [...accumulatedFeedData, ...feeds]
console.log('accumulatedFeedData', accumulatedFeedData.length)
if (itemCount >= 5000) {
const timeRemainingSince = nextSince - currentTime
console.log('timeRemainingSince', timeRemainingSince)
return getRecentlyUpdatedDataRecursively(accumulatedFeedData, timeRemainingSince)
} else {
console.log('return final data', accumulatedFeedData.length)
return accumulatedFeedData
}
}
/*
since = in seconds
*/
const getRecentlyUpdatedData = async (since?: number) => {
let url = `${podcastIndexConfig.baseUrl}/recent/data?max=5000`
url += `&since=${since ? since : -1800}`
const response = await axiosRequest(url)
return response && response.data
}
// const getRecentlyUpdatedPodcastFeeds = async () => {
// const url = `${podcastIndexConfig.baseUrl}/recent/feeds?sort=discovery&max=1000`
// const response = await axiosRequest(url)
// return response && response.data
// }
type PodcastIndexDataFeed = {
feedId: number
feedUrl: string
}
/*
This function determines if the feed.url returned by Podcast Index is not currently
the authority feedUrl in our database. If it is not, then update our database to use
the newer feed.url provided by Podcast Index.
*/
export const updateFeedUrlsIfNewAuthorityFeedUrlDetected = async (podcastIndexDataFeeds: PodcastIndexDataFeed[]) => {
try {
console.log('updateFeedUrlsIfNewAuthorityFeedUrlDetected', podcastIndexDataFeeds?.length)
const client = await getConnection().createEntityManager()
if (Array.isArray(podcastIndexDataFeeds)) {
for (const podcastIndexDataFeed of podcastIndexDataFeeds) {
try {
if (podcastIndexDataFeed.feedId) {
const currentFeedUrl = await getAuthorityFeedUrlByPodcastIndexId(podcastIndexDataFeed.feedId.toString())
if (currentFeedUrl && currentFeedUrl.url !== podcastIndexDataFeed.feedUrl) {
const podcastIndexFeed = {
id: podcastIndexDataFeed.feedId,
url: podcastIndexDataFeed.feedUrl
}
await createOrUpdatePodcastFromPodcastIndex(client, podcastIndexFeed)
}
}
} catch (err) {
console.log('updateFeedUrlsIfNewAuthorityFeedUrlDetected podcastIndexDataFeed', err)
}
}
}
} catch (err) {
console.log('updateFeedUrlsIfNewAuthorityFeedUrlDetected err', err)
}
}
/**
* addRecentlyUpdatedFeedUrlsToPriorityQueue
*
* Request a list of all podcast feeds that have been updated
* within the past X time from Podcast Index, then add
* the feeds that have a matching podcastIndexId in our database
* to the queue for parsing.
* sinceTime = epoch time to start from in seconds
*/
export const addRecentlyUpdatedFeedUrlsToPriorityQueue = async (sinceTime?: number) => {
try {
await connectToDb()
/* If no sinceTime provided, get all updated feeds from the past hour */
if (!sinceTime) {
sinceTime = Math.round(Date.now() / 1000) - 3600
}
const recentlyUpdatedFeeds = await getRecentlyUpdatedDataRecursively([], sinceTime)
console.log('total recentlyUpdatedFeeds count', recentlyUpdatedFeeds.length)
await updateFeedUrlsIfNewAuthorityFeedUrlDetected(recentlyUpdatedFeeds)
const recentlyUpdatedPodcastIndexIds = [] as any[]
for (const item of recentlyUpdatedFeeds) {
const { feedId } = item
if (feedId) {
recentlyUpdatedPodcastIndexIds.push(feedId)
}
}
const recentlyUpdatedPodcastIndexIdsChunks = chunkArray(recentlyUpdatedPodcastIndexIds, 500)
console.log('recentlyUpdatedPodcastIndexIdsChunks array count', recentlyUpdatedPodcastIndexIdsChunks.length)
let chunkIndex = 0
for (const chunk of recentlyUpdatedPodcastIndexIdsChunks) {
try {
chunkIndex++
console.log('sending feedUrls chunk to queue...', chunkIndex)
if (chunk.length > 0) {
await addFeedUrlsByPodcastIndexId(chunk)
}
} catch (error) {
console.log('addFeedUrlsByPodcastIndexId error:', error)
}
}
} catch (error) {
console.log('addRecentlyUpdatedFeedUrlsToPriorityQueue', error)
}
}
export const getPodcastFromPodcastIndexById = async (id: string) => {
const url = `${podcastIndexConfig.baseUrl}/podcasts/byfeedid?id=${id}`
const response = await axiosRequest(url)
return response && response.data
}
export const getPodcastValueTagForPodcastIndexId = async (id: string) => {
const podcast = await getPodcastFromPodcastIndexById(id)
const pvValueTagArray = convertPIValueTagToPVValueTagArray(podcast.feed.value)
return pvValueTagArray
}
export const getPodcastFromPodcastIndexByGuid = async (podcastGuid: string) => {
const url = `${podcastIndexConfig.baseUrl}/podcasts/byguid?guid=${podcastGuid}`
let podcastIndexPodcast: any = null
try {
const response = await axiosRequest(url)
podcastIndexPodcast = response.data
} catch (error) {
// assume a 404
}
if (!podcastIndexPodcast) {
throw new createError.NotFound('Podcast not found in Podcast Index')
}
return podcastIndexPodcast
}
// These getValueTagFor* services were intended for getting "value tag" info from Podcast Index,
// but at this point they more broadly is for retrieving the "remote item" data
// our client side apps need. The most common use case involves needing value tags
// for value time splits (VTS), but we also return additional data as the
// second item in the response data array, which gets handled as a "chapter"
// in the client side apps, to display to the listener which value time split track
// (usually a song) is playing right now.
export const getValueTagForChannelFromPodcastIndexByGuids = async (podcastGuid: string) => {
const url = `${podcastIndexConfig.baseUrl}/podcasts/byguid?guid=${podcastGuid}`
let podcastValueTag: ValueTagOriginal[] | null = null
try {
const response = await axiosRequest(url)
const data = response.data
if (data?.feed?.value) {
podcastValueTag = convertPIValueTagToPVValueTagArray(data.feed.value)
}
} catch (error) {
// assume a 404
}
if (!podcastValueTag || podcastValueTag?.length === 0) {
throw new createError.NotFound('Value tags not found')
}
return podcastValueTag
}
// see note above
export const getValueTagForItemFromPodcastIndexByGuids = async (podcastGuid: string, episodeGuid: string) => {
if (episodeGuid.indexOf('http') === 0) {
episodeGuid = encodeURIComponent(episodeGuid)
}
const url = `${podcastIndexConfig.baseUrl}/episodes/byguid?podcastguid=${podcastGuid}&guid=${episodeGuid}`
let episodeValueTag: ValueTagOriginal[] | null = null
try {
const response = await axiosRequest(url)
const data = response.data
if (data?.episode?.value) {
episodeValueTag = convertPIValueTagToPVValueTagArray(data.episode.value)
}
} catch (error) {
// assume a 404
}
if (!episodeValueTag || episodeValueTag?.length === 0) {
throw new createError.NotFound('Value tags not found')
}
return episodeValueTag
}
export const getEpisodesFromPodcastIndexById = async (podcastIndexId: string) => {
const url = `${podcastIndexConfig.baseUrl}/episodes/byfeedid?id=${podcastIndexId}&max=1000`
const response = await axiosRequest(url)
return response && response.data
}
export const getAllEpisodesFromPodcastIndexById = async (podcastIndexId: string) => {
// TODO: AFAIK Podcast Index does not support recursively paginating beyond 1000 results
// https://podcastindex-org.github.io/docs-api/#get-/episodes/byfeedid
// const allEpisodes = []
// let recursionLimit = 0
// const getEpisodesRecursively = async (id: string) => {
// try {
// if (recursionLimit >= 50) return
// const episodes = await getEpisodesFromPodcastIndexById(id)
// if (episodes.length > 0) {
// allEpisodes.concat(episodes)
// }
// if (episodes.length === 1000) {
// }
// } catch (error) {
// console.log('getAllEpisodesFromPodcastIndexById error', id, error)
// }
// }
// await getEpisodesRecursively(id)
const response = await getEpisodesFromPodcastIndexById(podcastIndexId)
const allEpisodes = response?.items
return allEpisodes
}
export const getAllEpisodeValueTagsFromPodcastIndexById = async (podcastIndexId: string) => {
const episodes = await getAllEpisodesFromPodcastIndexById(podcastIndexId)
const pvEpisodesValueTagsByGuid = {}
for (const episode of episodes) {
if (episode?.value && episode?.guid) {
const pvValueTagArray = convertPIValueTagToPVValueTagArray(episode.value)
if (pvValueTagArray?.length > 0) {
pvEpisodesValueTagsByGuid[episode.guid] = pvValueTagArray
}
}
}
return pvEpisodesValueTagsByGuid
}
export const addOrUpdatePodcastFromPodcastIndex = async (client: any, podcastIndexId: string) => {
const podcastIndexPodcast = await getPodcastFromPodcastIndexById(podcastIndexId)
const allowNonPublic = true
await createOrUpdatePodcastFromPodcastIndex(client, podcastIndexPodcast.feed)
const feedUrl = await getAuthorityFeedUrlByPodcastIndexId(podcastIndexId, allowNonPublic)
try {
const forceReparsing = true
const cacheBust = true
await parseFeedUrl(feedUrl, forceReparsing, cacheBust, allowNonPublic)
} catch (error) {
console.log('addOrUpdatePodcastFromPodcastIndex error', error)
}
}
export const addFeedsByPodcastIndexIdToQueue = async (client: any, podcastIndexIds: string[]) => {
for (const podcastIndexId of podcastIndexIds) {
try {
const podcastIndexItem = await getPodcastFromPodcastIndexById(podcastIndexId)
if (podcastIndexItem?.feed) {
await createOrUpdatePodcastFromPodcastIndex(client, podcastIndexItem.feed)
}
} catch (error) {
console.log('addFeedsByPodcastIndexIdToQueue error', error)
}
}
await addFeedUrlsByPodcastIndexId(podcastIndexIds)
}
const getNewFeeds = async () => {
const currentTime = new Date().getTime()
const { podcastIndexNewFeedsSinceTime } = podcastIndexConfig
// add 5 seconds to the query to prevent podcasts falling through the cracks between requests
const offset = 5000
const startRangeTime = Math.floor((currentTime - (podcastIndexNewFeedsSinceTime + offset)) / 1000)
console.log('currentTime----', currentTime)
console.log('startRangeTime-', startRangeTime)
const url = `${podcastIndexConfig.baseUrl}/recent/newfeeds?since=${startRangeTime}&max=1000`
console.log('url------------', url)
const response = await axiosRequest(url)
return response && response.data
}
/**
* addNewFeedsFromPodcastIndex
*
* Request a list of all podcast feeds that have been added
* within the past X minutes from Podcast Index, then add
* that feed to our database if it doesn't already exist.
*/
export const addNewFeedsFromPodcastIndex = async () => {
console.log('addNewFeedsFromPodcastIndex')
await connectToDb()
const client = await getConnection().createEntityManager()
try {
const response = await getNewFeeds()
const newFeeds = response.feeds
console.log('total newFeeds count', newFeeds.length)
for (const item of newFeeds) {
try {
await createOrUpdatePodcastFromPodcastIndex(client, item)
const feedUrl = await getFeedUrlByUrl(item.url)
await parseFeedUrl(feedUrl)
} catch (error) {
console.log('addNewFeedsFromPodcastIndex item', item)
console.log('addNewFeedsFromPodcastIndex error', error)
}
}
} catch (error) {
console.log('addNewFeedsFromPodcastIndex', error)
}
}
/**
* syncWithFeedUrlsCSVDump
*
* Basically, this function parses a CSV file of feed URLs provided by Podcast Index,
* then adds each feed URL to our database if it doesn't already exist,
* and retires the previous feed URLs saved in our database for that podcast if any exist.
*
* Longer explanation...
* This looks for a file named podcastIndexFeedUrlsDump.csv, then iterates through
* every podcastIndexItem in the file, then retrieves all existing feedUrls in our database
* that have a matching podcastIndexIds.
*
* When no feedUrl for that podcastIndexId exists, then creates a new feedUrl
* using the podcastIndexItem's information.
*
* When a feedUrl for that podcastIndexId exists, then promote the item's new url
* to be the authority feedUrl for that podcast, and demote any other feedUrls for that podcast.
*/
export const syncWithFeedUrlsCSVDump = async (rootFilePath) => {
await connectToDb()
try {
const csvFilePath = `${rootFilePath}/temp/podcastIndexFeedUrlsDump.csv`
console.log('syncWithFeedUrlsCSVDump csvFilePath', csvFilePath)
const client = await getConnection().createEntityManager()
await csv()
.fromFile(csvFilePath)
.subscribe((json) => {
return new Promise(async (resolve) => {
await new Promise((r) => setTimeout(r, 25))
try {
await createOrUpdatePodcastFromPodcastIndex(client, json)
} catch (error) {
console.log('podcastIndex:syncWithFeedUrlsCSVDump subscribe error', error)
}
resolve()
})
})
} catch (error) {
console.log('podcastIndex:syncWithFeedUrlsCSVDump', error)
}
}
async function createOrUpdatePodcastFromPodcastIndex(client, item) {
console.log('-----------------------------------')
console.log('createOrUpdatePodcastFromPodcastIndex')
if (!item || !item.url || !item.id) {
console.log('no item found')
} else {
const url = item.url
const podcastIndexId = item.id
const itunesId = parseInt(item.itunes_id) ? item.itunes_id : null
console.log('feed url', url, podcastIndexId, itunesId)
let existingPodcast = await getExistingPodcast(client, podcastIndexId)
if (!existingPodcast) {
console.log('podcast does not already exist')
const isPublic = true
await client.query(
`
INSERT INTO podcasts (id, "authorityId", "podcastIndexId", "isPublic")
VALUES ($1, $2, $3, $4);
`,
[shortid(), itunesId, podcastIndexId, isPublic]
)
existingPodcast = await getExistingPodcast(client, podcastIndexId)
} else {
const setSQLCommand = itunesId
? `SET ("podcastIndexId", "authorityId") = (${podcastIndexId}, ${itunesId})`
: `SET "podcastIndexId" = ${podcastIndexId}`
await client.query(
`
UPDATE "podcasts"
${setSQLCommand}
WHERE "podcastIndexId"=$1
`,
[podcastIndexId.toString()]
)
console.log('updatedPodcast id: ', existingPodcast.id)
console.log('updatedPodcast podcastIndexId: ', podcastIndexId)
console.log('updatedPodcast itunesId: ', itunesId)
}
const existingFeedUrls = await client.query(
`
SELECT id, url
FROM "feedUrls"
WHERE "podcastId"=$1
`,
[existingPodcast.id]
)
/*
In case the feed URL already exists in our system, but is assigned to another podcastId,
get the feed URL for the other podcastId, so it can be assigned to the new podcastId.
*/
const existingFeedUrlsByFeedUrl = await client.query(
`
SELECT id, url
FROM "feedUrls"
WHERE "url"=$1
`,
[url]
)
const combinedExistingFeedUrls = [...existingFeedUrls, ...existingFeedUrlsByFeedUrl]
console.log('existingFeedUrls count', existingFeedUrls.length)
for (const existingFeedUrl of combinedExistingFeedUrls) {
console.log('existingFeedUrl url / id', existingFeedUrl.url, existingFeedUrl.id)
const isMatchingFeedUrl = url === existingFeedUrl.url
await client.query(
`
UPDATE "feedUrls"
SET ("isAuthority", "podcastId") = (${isMatchingFeedUrl ? 'TRUE' : 'NULL'}, '${existingPodcast.id}')
WHERE id=$1
`,
[existingFeedUrl.id]
)
}
const updatedFeedUrlResults = await client.query(
`
SELECT id, url
FROM "feedUrls"
WHERE url=$1
`,
[url]
)
const updatedFeedUrl = updatedFeedUrlResults[0]
if (updatedFeedUrl) {
console.log('updatedFeedUrl already exists url / id', updatedFeedUrl.url, updatedFeedUrl.id)
} else {
console.log('updatedFeedUrl does not exist url / id')
const isAuthority = true
await client.query(
`
INSERT INTO "feedUrls" (id, "isAuthority", "url", "podcastId")
VALUES ($1, $2, $3, $4);
`,
[shortid(), isAuthority, url, existingPodcast.id]
)
}
}
console.log('*** finished entry')
}
const getExistingPodcast = async (client, podcastIndexId) => {
let podcasts = [] as any
if (podcastIndexId) {
podcasts = await client.query(
`
SELECT "authorityId", "podcastIndexId", id, title
FROM podcasts
WHERE "podcastIndexId"=$1;
`,
[podcastIndexId]
)
}
return podcasts[0]
}
export const hideDeadPodcasts = async (fileUrl?: string) => {
console.log('hideDeadPodcasts')
const url = fileUrl ? fileUrl : 'https://public.podcastindex.org/podcastindex_dead_feeds.csv'
console.log('url', url)
const response = await request(url, {
headers: {
'Content-Type': 'text/csv'
}
})
try {
await csv({ noheader: true })
.fromString(response)
.subscribe((json) => {
return new Promise(async (resolve) => {
await new Promise((r) => setTimeout(r, 5))
try {
if (json?.field1) {
try {
const podcast = await getPodcastByPodcastIndexId(json.field1)
if (podcast.isPublic) {
const repository = getRepository(Podcast)
podcast.isPublic = false
await new Promise((resolve) => setTimeout(resolve, 100))
await repository.save(podcast)
console.log('feed hidden successfully!', json.field1, json.field2)
}
} catch (error) {
if (error.message.indexOf('not found') === -1) {
console.log('error hiding podcast json', json)
console.log('error hiding podcast json error message:', error)
} else {
// console.log('feed already hidden', json.field1, json.field2)
}
}
}
} catch (error) {
console.log('podcastIndex:hideDeadPodcasts subscribe error', error)
}
resolve()
})
})
} catch (error) {
console.log('podcastIndex:hideDeadPodcasts', error)
}
console.log('hideDeadPodcasts finished')
}
export const getEpisodeByGuid = async (podcastIndexId: string, episodeGuid: string) => {
if (episodeGuid.indexOf('http') === 0) {
episodeGuid = encodeURIComponent(episodeGuid)
}
const url = `${podcastIndexConfig.baseUrl}/episodes/byguid?feedid=${podcastIndexId}&guid=${episodeGuid}`
const response = await axiosRequest(url)
return response && response.data
}