@@ -2,7 +2,7 @@ import { SAMPLE_PDF_URL, SAMPLE_EPUB_URL } from './constants';
2
2
import { OfflineIframe } from 'react-offline-iframe' ;
3
3
import React , { useEffect } from 'react' ;
4
4
import { SpecificAnnotationProps } from 'types' ;
5
- import { b64_to_utf8 , utf8_to_b64 , wait } from 'utils' ;
5
+ import { fetchUrl , b64_to_utf8 , utf8_to_b64 , wait } from 'utils' ;
6
6
import { deleteAnnotation , loadAnnotations , writeAnnotation } from 'annotationFileUtils' ;
7
7
import { Annotation } from './types' ;
8
8
import AnnotatorPlugin from 'main' ;
@@ -13,7 +13,6 @@ import { getSubtitles } from 'youtube-captions-scraper';
13
13
import getYouTubeMetaData from 'youtube-metadata-scraper' ;
14
14
import { deleteVideoAnnotation , loadVideoAnnotations , writeVideoAnnotation } from 'videoAnnotationFileUtils' ;
15
15
import { awaitResourceLoading , resourcesZip , resourceUrls } from 'resourcesFolder' ;
16
- import { corsFetch } from 'corsFetch' ;
17
16
18
17
const urlToPathMap = new Map ( ) ;
19
18
const proxiedHosts = new Set ( [ 'cdn.hypothes.is' , 'via.hypothes.is' , 'hypothes.is' , 'annotate.tv' ] ) ;
@@ -81,10 +80,10 @@ export default ({ vault, plugin }) => {
81
80
} ) ;
82
81
}
83
82
if ( href . startsWith ( `https://annotate.tv/api/transcript` ) && 'video' in props ) {
84
- const video_metadata = await getYouTubeMetaData ( corsFetch , props . video ) ;
83
+ const video_metadata = await getYouTubeMetaData ( fetchUrl , props . video ) ;
85
84
const video_id = video_metadata . shortlinkUrl . substr ( 'https://youtu.be/' . length ) ;
86
85
res = (
87
- await getSubtitles ( corsFetch , {
86
+ await getSubtitles ( fetchUrl , {
88
87
videoID : video_id , // youtube video id
89
88
lang : 'en' // default: `en`
90
89
} )
@@ -149,7 +148,7 @@ export default ({ vault, plugin }) => {
149
148
} ;
150
149
}
151
150
if ( href == `https://annotate.tv/videos/620d5a42b9ab630009bf3e31.html` && 'video' in props ) {
152
- const video_metadata = await getYouTubeMetaData ( corsFetch , props . video ) ;
151
+ const video_metadata = await getYouTubeMetaData ( fetchUrl , props . video ) ;
153
152
const video_id = video_metadata . shortlinkUrl . substr ( 'https://youtu.be/' . length ) ;
154
153
const video_data = {
155
154
props : {
@@ -332,7 +331,8 @@ export default ({ vault, plugin }) => {
332
331
return new Response ( null , { status : 404 , statusText : 'file not found' } ) ;
333
332
}
334
333
}
335
- return await corsFetch ( requestInfo , requestInit ) ;
334
+
335
+ return await fetchUrl ( requestInfo , requestInit ) ;
336
336
} }
337
337
htmlPostProcessFunction = { ( html : string ) => {
338
338
if ( 'pdf' in props ) {
0 commit comments