Skip to content

Commit

Permalink
添加<途牛>
Browse files Browse the repository at this point in the history
  • Loading branch information
leishufei committed May 21, 2021
1 parent 849a713 commit 9fe5b36
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 0 deletions.
3 changes: 3 additions & 0 deletions 途牛/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
> 网址
>
> https://www.tuniu.com/trips/31337925
36 changes: 36 additions & 0 deletions 途牛/demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2021/5/21
# @Author : Shufei Lei
# @Software : PyCharm
import requests
import execjs
import re


headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36 Edg/89.0.774.50',
'Referer': 'https://www.tuniu.com/trips/31337925',
'Host': 'www.tuniu.com'
}
with open(r'js_code.js', 'r', encoding="utf-8") as f:
ctx1 = execjs.compile(f.read())


def get_acw_sc__v2(arg):
acw_sc__v2 = ctx1.call('get_acw_sc__v2', arg)
return acw_sc__v2


url = 'https://www.tuniu.com/trips/30166638'
resp = requests.get(url, headers=headers, allow_redirects=False)
cookies = resp.cookies.get_dict()
print(cookies)
arg1 = re.search(r"var arg1='(.*?)';", resp.text).group(1)

acw_sc__v2 = get_acw_sc__v2(arg1)
cookies.update({'acw_sc__v2': acw_sc__v2})
print(cookies)

resp = requests.get(url, headers=headers, cookies=cookies)
print(resp.text)
53 changes: 53 additions & 0 deletions 途牛/js_code.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
var l = function (arg1) {
var _0x5e8b26 = "3000176000856006061501533003690027800375";

String["prototype"]["hexXor"] = function (_0x4e08d8) {
var _0x5a5d3b = "";

for (var _0xe89588 = 0; _0xe89588 < this["length"] && _0xe89588 < _0x4e08d8["length"]; _0xe89588 += 2) {
var _0x401af1 = parseInt(this["slice"](_0xe89588, _0xe89588 + 2), 16);

var _0x105f59 = parseInt(_0x4e08d8["slice"](_0xe89588, _0xe89588 + 2), 16);

var _0x189e2c = (_0x401af1 ^ _0x105f59)["toString"](16);

if (_0x189e2c["length"] == 1) {
_0x189e2c = "0" + _0x189e2c;
}

_0x5a5d3b += _0x189e2c;
}
return _0x5a5d3b;
};

String["prototype"]["unsbox"] = function () {
var _0x4b082b = [15, 35, 29, 24, 33, 16, 1, 38, 10, 9, 19, 31, 40, 27, 22, 23, 25, 13, 6, 11, 39, 18, 20, 8, 14, 21, 32, 26, 2, 30, 7, 4, 17, 5, 3, 28, 34, 37, 12, 36];
var _0x4da0dc = [];
var _0x12605e = "";

for (var _0x20a7bf = 0; _0x20a7bf < this["length"]; _0x20a7bf++) {
var _0x385ee3 = this[_0x20a7bf];

for (var _0x217721 = 0; _0x217721 < _0x4b082b["length"]; _0x217721++) {
if (_0x4b082b[_0x217721] == _0x20a7bf + 1) {
_0x4da0dc[_0x217721] = _0x385ee3;
}
}
}

_0x12605e = _0x4da0dc["join"]("");
return _0x12605e;
};

var _0x23a392 = arg1["unsbox"]();

arg2 = _0x23a392["hexXor"](_0x5e8b26);
return arg2
};

function get_acw_sc__v2(arg1){
return l(arg1)
}

var arg1 = "8CA42781D0C25B54F42A7FA731ADAD24470C34C8";
console.log(get_acw_sc__v2(arg1))

0 comments on commit 9fe5b36

Please sign in to comment.