快手视频无水印下载实现-2020年最新0+

20,103 views / 2020.03.14 / 9:09 下午

上文发了抖音的视频解析脚本后(原文:https://www.71j.cn/archives/493),很多朋友来问快手的有没有。
晚上吃完饭闲着没事,我把快手的安卓端逆向解析了下,发现也没什么难的,关键是有个签名要计算出来。
好,接下来,我们来解析这个地址:https://v.kuaishou.com/s/J87xkobF

$url = "https://v.kuaishou.com/s/J87xkobF";

首先把从apk中提取的几个神秘变量标记出来:

$salt = "382700b563f4";
$client_key = "3c2cd3f3";
$textApi = "http://api.gifshow.com/rest/n/tokenShare/info/byText";

接下来,算签名:

$str = "client_key=3c2cd3f3shareText=".$url.$salt;
$sign = md5($str);

然后获取视频的真实地址:

$data = http_build_query(array("client_key"=>$client_key,"shareText"=>$url,"sig"=>$sign));
    $opts = array(
      'http'=>array(
        'method'=>"POST",
        'header'=>$header. "Content-Length: " . strlen($data) . "\r\n",
        'content'=>$data
      )
    );
    $context = stream_context_create($opts);
    $content = file_get_contents($textApi, false, $context);

搞定。

完整的代码如下:

function kuaishou($url){
    //url: https://v.kuaishou.com/s/J87xkobF
    $salt = "382700b563f4";
    $str = "client_key=3c2cd3f3shareText=".$url.$salt;
    $sign = md5($str);
    $header = "User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 12_1_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/16D57 Version/12.0 Safari/604.1\r\n";
    $header .="Content-type: application/x-www-form-urlencoded\r\n";
    $data = http_build_query(array("client_key"=>"3c2cd3f3","shareText"=>$url,"sig"=>$sign));
    $opts = array(
      'http'=>array(
        'method'=>"POST",
        'header'=>$header. "Content-Length: " . strlen($data) . "\r\n",
        'content'=>$data
      )
    );
    $context = stream_context_create($opts);
    $content = file_get_contents("http://api.gifshow.com/rest/n/tokenShare/info/byText", false, $context);
    $j1 = json_decode($content, true);
    if($j1['result']!=1) exit("系统分析错误");
    echo $j1['shareTokenDialog']['feed']['main_mv_url'];
}

抖音视频无水印下载实现-2020年最新1+

120,493 views / 2020.03.11 / 12:12 上午

既然搜到了本文,您自然知道视频没有水印的重要性,那么如何来实现呢,读完本文,您会有透彻的了解。
为了逻辑清晰,便于讲解,本文借助PHP解析视频源地址,然后通过JSBOX将视频下载的手机,当然您也可以完全用JSBOX实现全部逻辑。

废话不多说,直接上代码:

<?php
$url = $_POST['u'];//这个u就是抖音分享单个视频后复制到剪贴板的地址
!preg_match("/^https/i",$url)&&exit("403");//做个简单的post验证
$header = "User-Agent: Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Mobile Safari/537.36\r\n";
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>$header
)
);
$context = stream_context_create($opts);
$content = file_get_contents($url, false, $context);
$try_itemId = preg_match('/itemId\: "([0-9]+)"/',$content, $itemId_match);
$try_dytk = preg_match('/dytk\: "([0-9a-z]+)"/',$content, $dytk_match);
if($try_itemId&&$try_dytk!=1) exit("系统分析错误");
$iteamId = $itemId_match[1];
$dytk = $dytk_match[1];
$cmd = file_get_contents("https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids=".$iteamId."&dytk=".$dytk, false, $context);
$j1 = json_decode($cmd,true);
echo ($j1['item_list'][0]['video']['play_addr']['url_list'][0]);

?>

服务端代码完毕。接下来用jsbox获取剪贴板中的抖音分享链接,将链接POST发送到服务端即可。这部分实现比较简单,就不再赘述。

至此,完毕。

抓取股票数据的定时任务怎么写?0+

57,701 views / 2020.02.28 / 12:12 下午

先写个crontab,规律性的执行一个php脚本,比如2分钟一次。脚本中抓取任务执行前加个stockday判断,就可以了。stockday的实现如下:
function stockday(){
$w = date(“w”,time());
if($w==0||$w==6) return false;//周一到周五执行
//开盘时间大家都知道
$checkDayStr = date(‘Y-m-d ‘,time());
$timeBegin1 = strtotime($checkDayStr.”09:20:00″);
$timeEnd1 = strtotime($checkDayStr.”11:30:00″);
$timeBegin2 = strtotime($checkDayStr.”13:00:00″);
$timeEnd2 = strtotime($checkDayStr.”15:02:00″);
$curr_time = time();
if($curr_time >= $timeBegin1 && $curr_time <= $timeEnd1){
return true;
}
if($curr_time >= $timeBegin2 && $curr_time <= $timeEnd2){
return true;
}
return false;
}

Categories: 感悟 Tags:

gost穿透公司内网控制公司服务器0+

76,441 views / 2019.12.09 / 1:01 下午

1. 需要一台外网服务器,在上面执行:
./gost -L=ss2://AEAD_CHACHA20_POLY1305:password@:443 -L=auto://127.0.0.1:1080
2.在公司内网一台跳板机上建立通道,注意,需要可以上面那台访问外网服务器。
gost.exe -L=rtcp://127.0.0.1:9822/要控制的的服务器ip:22 -F=ss2://AEAD_CHACHA20_POLY1305:password@外网服务器ip:443?ping=300 -F socks5://127.0.0.1:1080
3.在外网服务器就可以访问内网的要控制的服务器了:
ssh -p 9822 root@127.0.0.1

Categories: 感悟 Tags:

基于以太坊私有链搭建一个分布式应用【3】0+

37,400 views / 2018.03.15 / 11:11 下午

搭建Dapp(分布式应用)

非常不情愿的安装npm,然后sudo npm install -g truffle

会出现一个很NB的动画安装过程,默默地欣赏…

71j.cn@ubuntu:~$ mkdir dapp

71j.cn@ubuntu:~$ cd dapp

truffle unbox webpack # 初始化一个带ui的truffle项目

/usr/bin/env: ‘node’: No such file or directory

sudo ln -s /usr/bin/nodejs /usr/bin/node

又报错:

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

因为 node的版本太低

sudo npm install -g n

sudo n stable

再来truffle unbox webpack,成功后可以看下当前的目录结构:

-contracts //智能合约存放目录

-migrations //智能合约abi及部署信息存目录

-test //测试文件

-truffle.js //truffle默认配置

-truffle-config.js //Windows下默认配置文件名与truffle冲突,可使用该文件解决

修改webpack.config.js,添加如下代码制定运行的服务器ip,注意如果只监听localhost, 理论上无法通过IP:PORT的方式访问。

devServer: {

host: ‘10.120.113.245’,

port: 8080,

},

配置truffle.js到私链:

module.exports = {

// See <http://truffleframework.com/docs/advanced/configuration>

// to customize your Truffle configuration!

networks: {

development: {

host: “10.120.113.245”,

port: 8101,

network_id: “*”, // * Match any network id

gas:4712388, //Gas limit used for deploys. Default is web3.eth.getBlock(“pending”).gasLimit==4712388.

gasPrice:18000000000, //Gas price used for deploys. Default is 100000000000 (100 Shannon).

from: “0xf4182f0dc92313f8e106fc033641c3351703911f”//From address used during migrations. Defaults to the first available account provided by your Ethereum client.

// provider – web3 provider instance Truffle should use to talk to the Ethereum network.

//          – function that returns a web3 provider instance (see below.)

//          – if specified, host and port are ignored.

}

},

solc: {

optimizer: {

enabled: true,

runs: 200

}

},

};

 

truffle migrate # Build, compile, & deploy the dap

这个过程比较慢,耐心等待。

npm run dev

就可以通过浏览器http:// 10.120.113.245:8101访问了。

 

部署自己的合约程序

 

deploy//这都是要自己编写的,具体的看代码吧,点这里下载

├── app

│   ├── index.html

│   ├── javascripts

│   │   └── app.js

│   └── stylesheets

│       └── app.css

├── contracts

│   ├── Conference.sol

│   └── Migrations.sol//这个是truffle管理合约用的合约

└── test

└── conference.js

 

rm -rf dapp/app

rm -rf dapp/contracts

rm -rf dapp/test

然后把deploy中的文件都复制到dapp中,进入dapp:

71j.cn@ubuntu:~/dapp$ truffle migrate –reset

Using network ‘development’.

 

Running migration: 1_initial_migration.js

Replacing Migrations…

… 0x08a2db9ceda488eb534f4e0364dc21d569ad7a7d822c12f2007021ff67d8dc3b

Migrations: 0xec2264304e81fe2a3d5f3f316ecd627ea44c285d

Saving successful migration to network…

… 0xfa324a40aac5d0d89da7c05ddb5382bc2c56bd21e92a4f2b5b34325c526c7d5e

Saving artifacts…

Running migration: 2_deploy_contracts.js

Replacing Conference…

… 0x2c45e7be5c5a40770a99c4a59e1f09bdc69168c96d45be62e46c6ba053d77cda

Conference: 0x7d2c18809639c3a019e3b82c3ec39da526a8beb2

Saving successful migration to network…

… 0x37fe62d2822977d15a2261c28f599df0418e567b0a0ed38870e4d556d5f12d4c

Saving artifacts…

 

然后看看我们的测试用例编写的怎样?

appadmin@ubuntu:~/dapp$ truffle test

Using network ‘development’.

 

[ ‘0xf4182f0dc92313f8e106fc033641c3351703911f’,

‘0x899a969874bec249e4ef439c75adb0c358913b95’,

‘0x6797c39109ec4676d3b5dbb4dc76f1143a0f633a’ ]

 

 

Contract: Conference

✓ Initial conference settings should match (2068ms)

✓ Should update quota (3570ms)

1) Should let you buy a ticket

 

Events emitted during test:

—————————

 

Deposit(_from: 0x899a969874bec249e4ef439c75adb0c358913b95, _amount: 1000000000000000000)

 

—————————

✓ Should issue a refund by owner only (10310ms)

 

 

3 passing (20s)

1 failing

 

1) Contract: Conference Should let you buy a ticket:

AssertionError: Difference should be what was sent: expected 11001296558000000000 to equal ‘1000000000000000000’

at test/conference.js:63:11

at <anonymous>

at process._tickCallback (internal/process/next_tick.js:118:7)

 

为什么有一个没通过?因为那哥们在挖矿呢…,把挖矿的改成account[3]就好了。

npm run dev

通过浏览器访问http:// 10.120.113.245:8101即可。

Categories: 感悟 Tags: