Skip to content

Commit

Permalink
🖱设置dycookie #3 #5 #14 #15 #17
Browse files Browse the repository at this point in the history
  • Loading branch information
Johnserf-Seed committed Apr 9, 2023
1 parent cec95e6 commit da33041
Showing 1 changed file with 101 additions and 9 deletions.
110 changes: 101 additions & 9 deletions views/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,13 @@
<script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
<script>
$(document).ready(function(){
var video_info = document.getElementById("video-info");
// video_info.style.display = "none";
// $("#video-info").style.display='none';
$('#setcookie').click(function(){
if($('#cookieform').is(':hidden')){
$('#cookieform').show();
} else {
$('#cookieform').hide();
}
})
try {
let seachTxt = window.location.href.split("=");
// 00000000 ['http://localhost:3000/']
Expand All @@ -90,24 +94,68 @@
}
});
</script>
<script>
$(document).ready(function(){
if (!$.cookie('dycookie')){
alert('请先填写抖音的cookie才可以正常解析作品')
} else {
var dycookie = JSON.parse($.cookie('dycookie'));
$('#odin_tt_Field').val(dycookie['odin_tt'])
$('#passport_csrf_token_Field').val(dycookie['passport_csrf_token'])
$('#sessionid_ss_Field').val(dycookie['sessionid_ss'])
$('#ttwid_Field').val(dycookie['ttwid'])
$('#msToken_Field').val(dycookie['msToken'])
}
});
</script>
<title>TikTokWeb</title>
</head>
<body class="bs-docs-home">
<div class="col-md-8">
<div class="tk">
<h1>TikTokWeb</h1>
<blockquote>
<p><em>输入长短链点击解析视频试试吧</em></p>
<p><em>先填写你的抖音cookie,然后输入长短链点击解析试试吧🎉</em></p>
</blockquote>
<div class="input-group input-group-lg" style="margin-bottom: 10px;">
<input type="text" class="form-control link-input" name="请输入链接" value="https://v.douyin.com/NKyY6Ch/" id="video_url">
<div class="input-group-btn">
<div class="btn-clear" id="btn-clear">
<button class="btn btn-default" type="button" value="处理" id="get">解析视频</button>
</div>
<div class="input-group-btn">
<div class="btn-clear" id="btn-clear">
<button class="btn btn-default" type="button" value="解析" id="get">解析</button>
<button class="button button-clear" type="submit" value="设置Cookie" id="setcookie">设置Cookie</button>
</div>
</div>
</div>
<div style="display: none;" id="video-info">
<form style="display: none;" id="cookieform">
<fieldset>
<ul>
<li>
只需填写cookie的value,不需要填写key 😀
</li>
<li>
例如 odin_tt的值是718d2ae9ed49a5fd4fc1…………只需要填这部分即可 🥴
</li>
<li>
你的所有信息均储存在本地 🚨
</li>
</ul>
<pre class="savesuccess" style="display: none;"><code>保存成功</code></pre>
<pre class="saveerror" style="display: none;"><code>保存失败</code></pre>
<label for="odin_tt_Field">odin_tt</label>
<input type="text" placeholder="odin_tt的值" id="odin_tt_Field">
<label for="passport_csrf_token_Field">passport_csrf_token</label>
<input type="text" placeholder="passport_csrf_token的值" id="passport_csrf_token_Field">
<label for="sessionid_ss_Field">sessionid_ss</label>
<input type="text" placeholder="sessionid_ss的值" id="sessionid_ss_Field">
<label for="ttwid_Field">ttwid</label>
<input type="text" placeholder="ttwid的值" id="ttwid_Field">
<label for="msToken_Field">msToken</label>
<input type="text" placeholder="msToken的值" id="msToken_Field">
<button class="btn btn-default" type="button" value="保存" id="savecookie">保存</button>
<button class="btn btn-default" type="button" value="清理" id="cleancookie">清理</button>
</fieldset>
</form>
<div style="display: none;" id="video_info">
<span>
<div class="card">
<div class="card-body">
Expand Down Expand Up @@ -161,6 +209,10 @@ <h1>TikTokWeb</h1>
</div>
<script>
$("#get").click(function(){
if (!$.cookie('dycookie')){
alert('请先填写抖音的cookie才可以正常解析作品')
return 0;
}
let url = $('#video_url').val()
if (!url){
alert("空链接");
Expand Down Expand Up @@ -206,5 +258,45 @@ <h1>TikTokWeb</h1>
});
*/
</script>
<script>

$("#savecookie").click(function(){
const dycookie = {
odin_tt:$('#odin_tt_Field').val(),
passport_csrf_token: $('#passport_csrf_token_Field').val(),
sessionid_ss: $('#sessionid_ss_Field').val(),
ttwid: $('#ttwid_Field').val(),
msToken: $('#msToken_Field').val(),
};
//var cookie = 'dycookie' + "=" + JSON.stringify(dycookie) + '; max-age=' + 30 * 24 * 60 * 60;
try {
$.cookie('dycookie', JSON.stringify(dycookie), { expires: 30 });
//document.cookie = cookie;
//localStorage.setItem("dycookie", JSON.stringify(dycookie));
alert('保存成功')
$('#cookieform').hide();
} catch {
alert('保存失败')
$('#cookieform').hide();
}
});
$("#cleancookie").click(function(){
try {
$.removeCookie('dycookie',{ path: '/'});
$('#odin_tt_Field').val('')
$('#passport_csrf_token_Field').val('')
$('#sessionid_ss_Field').val('')
$('#ttwid_Field').val('')
$('#msToken_Field').val('')
//localStorage.removeItem("dycookie");
alert('清理成功')
$('#cookieform').hide();
} catch (error) {
alert('清理失败')
console.log(error)
$('#cookieform').hide();
}
});
</script>
</body>
</html>

0 comments on commit da33041

Please sign in to comment.