增加cookie,useragent配置

master
panqihua 2 years ago
parent a0a92ddbbd
commit c851286485
  1. 14
      pixiv/config.json.example
  2. 12
      pixiv/pixiv.sh

@ -1,9 +1,15 @@
{ {
"basePath": "本地缓存路径,包括接口数据,图片等", "basePath": "本地缓存路径,包括接口数据,图片等",
"telegramToken": "telegram 机器人申请的API Token", "telegram":{
"chatId": "推送目标聊天的唯一标识符或目标频道的用户名", "telegramToken": "telegram 机器人申请的API Token",
"mode": "Pixiv排行榜类型,有效值:daily/weekly/monthly/rookie/daily_r18/weekly_r18/male_r18/female_r18/r18g,分别是日榜/周榜/月榜/新人榜/日榜r18/周榜r18/受男性欢迎r18/受女性欢迎r18/r18g", "chatId": "推送目标聊天的唯一标识符或目标频道的用户名"
"content": "Pixiv排行榜类型,有效值:illust/ugoira/manga/,分别是插画/动图/漫画", },
"pixiv":{
"mode": "Pixiv排行榜类型,有效值:daily/weekly/monthly/rookie/daily_r18/weekly_r18/male_r18/female_r18/r18g,分别是日榜/周榜/月榜/新人榜/日榜r18/周榜r18/受男性欢迎r18/受女性欢迎r18/r18g",
"content": "Pixiv排行榜类型,有效值:illust/ugoira/manga/,分别是插画/动图/漫画",
"cookie_param":"Pixiv 用户cookie",
"user_agent":"请求头User-Agent"
},
"aliyun_oss":{ "aliyun_oss":{
"Host":"Endpoint(地域节点)", "Host":"Endpoint(地域节点)",
"accelerateHost":"传输加速Endpoint(地域节点)", "accelerateHost":"传输加速Endpoint(地域节点)",

@ -160,11 +160,13 @@ GetBucketV2 | xmlstarlet select -t -m '/ListBucketResult//Contents' -v 'Key' -n
fi fi
done done
telegramToken=$(cat $config_file | jq -r .telegramToken) telegramToken=$(cat $config_file | jq -r .telegram.telegramToken)
baseApi="https://api.telegram.org/bot$telegramToken" baseApi="https://api.telegram.org/bot$telegramToken"
chat_id=$(cat $config_file | jq .chatId) chat_id=$(cat $config_file | jq .telegram.chatId)
mode=$(cat $config_file | jq -r .mode) mode=$(cat $config_file | jq -r .pixiv.mode)
content=$(cat $config_file | jq -r .content) content=$(cat $config_file | jq -r .pixiv.content)
cookie_param=$(cat $config_file | jq -r .pixiv.cookie_param)
user_agent=$(cat $config_file | jq -r .pixiv.user_agent)
rank_url="https://www.pixiv.net/ranking.php?mode=$mode&content=$content&p=1&format=json" rank_url="https://www.pixiv.net/ranking.php?mode=$mode&content=$content&p=1&format=json"
today=$(date "+%Y-%m-%d") today=$(date "+%Y-%m-%d")
_today=$(date "+%Y%m%d") _today=$(date "+%Y%m%d")
@ -216,7 +218,7 @@ for index in $(seq 1 $length); do
png_html_file=$pid.html png_html_file=$pid.html
if [ ! -f $png_html_file ]; then if [ ! -f $png_html_file ]; then
echo "get data from $artworkLink" echo "get data from $artworkLink"
curl -v $artworkLink >$png_html_file curl -v -H "cookie: $cookie_param" -H "user-agent:$user_agent" $artworkLink >$png_html_file
fi fi
json_file=$pid.json json_file=$pid.json
if [ ! -f $json_file ]; then if [ ! -f $json_file ]; then

Loading…
Cancel
Save