|
@@ -353,9 +353,7 @@
|
|
|
const axios = require('axios');
|
|
|
const StealthPlugin = require('puppeteer-extra-plugin-stealth');
|
|
|
const { ipcRenderer } = require('electron');
|
|
|
- const fakeUa = require('fake-useragent');
|
|
|
- const userStr = fakeUa();
|
|
|
- console.log(userStr);
|
|
|
+
|
|
|
let separator = '';
|
|
|
if (os.platform == 'linux') {
|
|
|
separator = '/'
|
|
@@ -430,6 +428,11 @@
|
|
|
this.downloadDir = homedir + separator + "Downloads"
|
|
|
}
|
|
|
|
|
|
+ let dir = this.$utils.getStorage('downloadDir');
|
|
|
+ if(dir){
|
|
|
+ this.downloadDir = dir;
|
|
|
+ }
|
|
|
+
|
|
|
if (!fs.existsSync(os.tmpdir() + separator + 'chrome-data-capture-video')) {
|
|
|
fs.mkdirSync(os.tmpdir() + separator + 'chrome-data-capture-video');
|
|
|
}
|
|
@@ -456,7 +459,6 @@
|
|
|
// 发送事件到主进程,附带元素类型信息
|
|
|
ipcRenderer.send('show-context-menu', 'input');
|
|
|
});
|
|
|
-
|
|
|
},
|
|
|
methods: {
|
|
|
// 实时获取开发者设置
|
|
@@ -485,6 +487,16 @@
|
|
|
let chromePath = puppeteer.executablePath().replace('win32-1', 'win64-1');
|
|
|
return chromePath;
|
|
|
},
|
|
|
+ // 实时获取代理设置-微博
|
|
|
+ initAgent(){
|
|
|
+ let weiboAgent = this.$utils.getStorage('weiboAgent');
|
|
|
+ let isAgent = this.$utils.getStorage('isAgent');
|
|
|
+ if(isAgent == -1){ // 关闭代理
|
|
|
+ return '';
|
|
|
+ }else{
|
|
|
+ return weiboAgent;
|
|
|
+ }
|
|
|
+ },
|
|
|
checkAuthority(){
|
|
|
let authority = this.$refs.headerRef.authority;
|
|
|
this.$refs.imgRef.authority = authority;
|
|
@@ -495,6 +507,7 @@
|
|
|
electronApi.call('pickDir', []).then((path) => {
|
|
|
if (path) {
|
|
|
this.downloadDir = path;
|
|
|
+ this.$utils.setStorage('downloadDir', path);
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -715,10 +728,6 @@
|
|
|
// console.log(err);
|
|
|
})
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
},
|
|
|
biliDetail(row){
|
|
|
this.biliInfo = row;
|
|
@@ -808,10 +817,11 @@
|
|
|
this.selectIndex = -1;
|
|
|
this.videoList = [];
|
|
|
let userAgent = [];
|
|
|
- if(formatUrl.indexOf('weibo.com/') > -1){
|
|
|
+ let setingAgent = this.initAgent();
|
|
|
+ if(formatUrl.indexOf('weibo.com/') > -1 && setingAgent){
|
|
|
userAgent = [
|
|
|
'--add-header',
|
|
|
- 'User-Agent:Mozilla/5.0 (Windows NT 11.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.6998.166 Safari/537.36',
|
|
|
+ 'User-Agent:'+setingAgent,
|
|
|
'--add-header',
|
|
|
"Referer:https://weibo.com/"
|
|
|
];
|
|
@@ -965,10 +975,11 @@
|
|
|
return false;
|
|
|
}else{
|
|
|
let userAgent = [];
|
|
|
- if(this.downloadUrl.indexOf('weibo.com/') > -1){
|
|
|
+ let setingAgent = this.initAgent();
|
|
|
+ if(this.downloadUrl.indexOf('weibo.com/') > -1 && setingAgent){
|
|
|
userAgent = [
|
|
|
'--add-header',
|
|
|
- 'User-Agent:Mozilla/5.0 (Windows NT 11.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.6998.166 Safari/537.36',
|
|
|
+ 'User-Agent:'+setingAgent,
|
|
|
'--add-header',
|
|
|
"Referer:https://weibo.com/"
|
|
|
];
|