randydev commited on
Commit
c935a34
·
verified ·
1 Parent(s): 0db989d

Update lib/youtube/youtube.js

Browse files
Files changed (1) hide show
  1. lib/youtube/youtube.js +16 -12
lib/youtube/youtube.js CHANGED
@@ -71,17 +71,21 @@ export async function convert(vid, k) {
71
  vid,
72
  k
73
  };
 
 
 
 
 
 
 
 
 
 
74
 
75
- const data = await got.post('https://www.y2mate.com/mates/convertV2/index', {
76
- headers: {
77
- ...DEFAULT_HEADERS,
78
- 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
79
- cookie: '_ga=GA1.1.1058493269.1720585210; _ga_PSRPB96YVC=GS1.1.1720585209.1.1.1720585486.0.0.0',
80
- origin: 'https://www.y2mate.com'
81
- },
82
- form
83
- }).json();
84
-
85
- const json = ConvertResponseSchema.parse(data);
86
- return json.dlink;
87
  }
 
71
  vid,
72
  k
73
  };
74
+ try {
75
+ const data = await got.post('https://www.y2mate.com/mates/convertV2/index', {
76
+ headers: {
77
+ ...DEFAULT_HEADERS,
78
+ 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
79
+ cookie: '_ga=GA1.1.1058493269.1720585210; _ga_PSRPB96YVC=GS1.1.1720585209.1.1.1720585486.0.0.0',
80
+ origin: 'https://www.y2mate.com'
81
+ },
82
+ form
83
+ }).json();
84
 
85
+ const json = ConvertResponseSchema.parse(data);
86
+ return json.dlink;
87
+ } catch (error) {
88
+ console.error("Error in convert function:", error);
89
+ return "";
90
+ }
 
 
 
 
 
 
91
  }