Changeset 3256233
- Timestamp:
- 03/15/2025 11:59:30 AM (13 months ago)
- Location:
- wxsync/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (2 diffs)
-
wxsync.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wxsync/trunk/readme.txt
r2958751 r3256233 3 3 Donate link: http://std.cloud 4 4 Tags: 微信公众号,免费,公众号文章采集,数据采集,微信公众号采集 5 Stable tag: 2. 7.255 Stable tag: 2.8.0 6 6 Tested up to: 6.3 7 7 License: GPLv2 or later … … 32 32 33 33 == Changelog == 34 2.8.0 修复微信无法采集 35 34 36 2.7.25 修复bug 35 37 -
wxsync/trunk/wxsync.php
r2958751 r3256233 4 4 Plugin URI: http://std.cloud 5 5 Description: 标准云微信公众号文章免费采集、<strong>任意公众号自动采集付费购买</strong> 6 Version: 2. 7.256 Version: 2.8.0 7 7 Author: 标准云(std.cloud) 8 8 Author URI: http://std.cloud … … 24 24 $GLOBALS['wxsync_tab'] = ''; 25 25 $GLOBALS['wxsync_error'] = array(); 26 $GLOBALS['wxsync_ver'] = '2. 7.25';26 $GLOBALS['wxsync_ver'] = '2.8.0'; 27 27 $GLOBALS['wxsync_code'] = 0; 28 28 … … 53 53 54 54 function wxsync_onrequest(){ 55 error_reporting(E_ERROR); 55 56 56 57 57 $req = array(); 58 58 59 59 $keys = array('wxsync_tab','article_urls','wxsync_settoken','wxsync_token','article_thumbnail' 60 ,'urls','override','article_time','article_status','article_cate','article_source','article_style','wxsync_setsourcetxt','article_type','article_checkrepeat'61 ,'wxsync_rmheadimg','wxsync_rmtailimg','wxsync_replace_words','article_imgurl','article_href','article_debug','article_raw'62 ,'host','port','username','password','article_remotetag','article_remote_a_href'63 ,'article_userid','article_removeblank','article_tags','wxsync_autoproxyset_token'60 ,'urls','override','article_time','article_status','article_cate','article_source','article_style','wxsync_setsourcetxt','article_type','article_checkrepeat' 61 ,'wxsync_rmheadimg','wxsync_rmtailimg','wxsync_replace_words','article_imgurl','article_href','article_debug','article_raw' 62 ,'host','port','username','password','article_remotetag','article_remote_a_href' 63 ,'article_userid','article_removeblank','article_tags','wxsync_autoproxyset_token' 64 64 ); 65 65 foreach ($keys as $one){ … … 94 94 $GLOBALS['wxsync_tab'] = $req['wxsync_tab']; 95 95 if($req['wxsync_tab'] == 'manual'){ 96 // 验证Nonce 97 if (isset($_POST['wxsync_nonce_field'])) { 98 // 验证nonce 99 if (wp_verify_nonce($_POST['wxsync_nonce_field'], 'wxsync_manual_action')) { 100 // 你的代码逻辑 101 } else { 102 // 非法请求 103 echo '你没有权限执行这个操作'; 104 array_push($GLOBALS['wxsync_error'],'你没有权限执行这个操作'); 105 return; 106 } 107 } 108 109 96 110 if(!is_admin()){ 97 111 return; … … 130 144 )); 131 145 }else if($req['wxsync_tab'] == 'autoset'){ 132 if(isset($req['wxsync_settoken'])){146 if(isset($req['wxsync_settoken'])){ 133 147 if(!is_admin()){ 134 148 return; 135 149 } 136 150 global $wpdb,$table_prefix; 137 $find = $wpdb->get_var("SHOW TABLES LIKE '{$table_prefix}wxsync_config'");151 $find = $wpdb->get_var("SHOW TABLES LIKE '{$table_prefix}wxsync_config'"); 138 152 if (empty($find)) { 139 153 $sql = "CREATE TABLE `{$table_prefix}wxsync_config` ( … … 565 579 $html = $article_raw[$index - 1]; 566 580 }else{ 567 $output = wp_remote_get( $url, array('timeout' => 30)); 581 $output = wp_remote_get( $url, array('timeout' => 30, 582 'user-agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36', 583 'Referer' => 'https://weixin.sogou.com', 584 )); 568 585 $html = wp_remote_retrieve_body( $output ); 569 586 $check = json_encode($html); … … 872 889 } 873 890 } 874 891 875 892 if('keep' == $article_thumbnail && !empty($vardict['thumbnail'])){ 876 893 set_post_thumbnail($pid, $vardict['thumbnail']); … … 897 914 require_once(ABSPATH . 'wp-admin/includes/image.php'); 898 915 899 // $tmp = download_url( $url ); 916 917 900 918 $url = str_replace('&', '&', $url); 901 919 $tmpfname = wp_tempnam(basename(parse_url($url, PHP_URL_PATH))); … … 904 922 $newname = 'wxsync-'.date('Y-m').'-'.md5($url).'.' . $type; 905 923 906 $resid = get_attachment_url_by_title('wxsync-'.date('Y-m').'-'.md5($url));924 $resid = 0;//get_attachment_url_by_title('wxsync-'.date('Y-m').'-'.md5($url)); 907 925 if($resid > 0){ 908 926 $att_id = $resid; 909 927 }else{ 910 928 global $tmp_proxy; 911 $is_remote_daili = false; 912 $is_remote_daili_ret = ''; 913 if(empty($tmp_proxy)){ 914 //本地没有,从主站获取 915 global $wpdb,$table_prefix; 916 917 $sql = "select * from {$table_prefix}wxsync_config where id = 4"; 918 $sql = $wpdb->prepare($sql,array()); 919 $cfgtxt = $wpdb->get_row($sql,ARRAY_A,0); 920 if(!empty($cfgtxt)){ 921 $wxsync_autoproxyset_token = $cfgtxt['token']; 922 $is_remote_daili = true; 923 924 $url_proxy = "http://proxyip.std.cloud/web/api/Proxyip/getip?token=$wxsync_autoproxyset_token"; 925 $ch = curl_init(); 926 curl_setopt($ch, CURLOPT_URL, $url_proxy); 927 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 928 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); 929 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 930 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300); 931 $str = curl_exec($ch); 932 curl_close($ch); 933 934 $is_remote_daili_ret = $str; 935 $obj_s = json_decode($str,true); 936 if(!empty($obj_s['info']['ip'])){ 937 $tmp_proxy = [ 938 'host'=>$obj_s['info']['ip'], 939 'port'=>$obj_s['info']['port'], 940 'username'=>$obj_s['info']['key'], 941 'password'=>$obj_s['info']['auth'], 942 ]; 943 944 } 945 } 946 947 } 929 930 948 931 949 932 $tmp = wp_safe_remote_get($url, array('filename' => $tmpfname,'stream' => true,'timeout' => 300 950 ,'headers' => array('referer' => $url),951 'user-agent' => 'Mozilla/5.0 ( iPhone; CPU iPhone OS 11_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1',933 ,'headers' => array('referer' => 'https://mp.weixin.qq.com/'), 934 'user-agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36', 952 935 )); 936 953 937 if ( is_wp_error( $tmp ) ) { 954 $UserAgent = 'Mozilla/5.0 ( iPhone; CPU iPhone OS 11_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1';938 $UserAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36'; 955 939 $ch = curl_init(); 956 940 curl_setopt($ch, CURLOPT_URL, $url); … … 958 942 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); 959 943 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 960 curl_setopt($ch, CURLOPT_REFERER, $url);944 curl_setopt($ch, CURLOPT_REFERER, 'https://mp.weixin.qq.com/'); 961 945 curl_setopt($ch, CURLOPT_USERAGENT, $UserAgent); 962 946 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 300); … … 969 953 // curl_setopt($ch, CURLOPT_PROXYAUTH, CURLAUTH_ANY); 970 954 curl_setopt($ch,CURLOPT_PROXYUSERPWD,$userAndPass); // curl_setopt($ch,CURLOPT_PROXYUSERPWD,'user:password'); 971 }else{972 if($is_remote_daili){973 array_push($GLOBALS['wxsync_error'],'自动代理设置失败:'.$is_remote_daili_ret);974 }975 976 977 955 } 978 956 $file = curl_exec($ch); … … 1016 994 1017 995 $GLOBALS['wxsync_article_att_ids'][] = $att_id; 1018 996 1019 997 return array($ret[0],$att_id); 1020 998 }
Note: See TracChangeset
for help on using the changeset viewer.