binux / qiandao

签到
https://qiandao.today
3.42k stars 706 forks source link

请求地址带时间戳如何指定? #39

Closed morefreeze closed 7 years ago

morefreeze commented 7 years ago

比如现在A站的签到变到类似这样的 http://www.acfun.tv/webapi/record/actions/signin?channel=0&date=1481267468594

后面是个签到的时间戳,给哪一天的时间戳就算哪天,所以这个必须给,但每天都会变,有这样的变量吗

legendtang commented 7 years ago

同问,17wo 的请求也带时间戳

binux commented 7 years ago

{{ timestamp() }}

morefreeze commented 7 years ago

@binux 感谢,其实我想问的这个函数支持列表哪里有?比如我还要对时间作些操作

binux commented 7 years ago

@morefreeze https://github.com/binux/qiandao/blob/master/libs/utils.py#L221http://jinja.pocoo.org/docs/dev/templates/

legendtang commented 7 years ago

@binux 添加了这个模板为什么创建的时候要求填写 timestamp?

binux commented 7 years ago

@legendtang 这是一个 bug

legendtang commented 7 years ago

@binux failed at 2/2 request, error:AttributeError("'unicode' object has no attribute '__call__'",), http://www.acfun.tv/webapi/record/actions/signin?channel=0&date={{ timestamp() }} 我遇到了这个错误,这个能正常使用吗?

legendtang commented 7 years ago

@morefreeze 为什么关了 issue?你确定可以正常使用?

morefreeze commented 7 years ago

可以,得到的是一个带小数点的数,虽然我想要个int 但配置jinja的filter已经够了 你这个问题没遇到过,更新到最新代码了吗

morefreeze commented 7 years ago

BTW, A站的签到如果不传timestamp是签当天的,传的话可能是补签,目前不填参数已经满足需求了

legendtang commented 7 years ago

@morefreeze 这样 int 拿到的是以秒为单位的 timestamp,而不能拿到 JS 网页中的毫秒级的,这里 filter 似乎不能做乘法?