diff --git a/.gitignore b/.gitignore
index 0bcc7c4..83828ac 100644
--- a/.gitignore
+++ b/.gitignore
@@ -73,3 +73,5 @@ fabric.properties
.idea
time.log
+
+.DS_Store
\ No newline at end of file
diff --git a/README.md b/README.md
index 9d9eed2..31ebcd4 100644
--- a/README.md
+++ b/README.md
@@ -3,4 +3,6 @@
编辑[rename.sh](git/rename.sh)需要修改的提交历史时间戳条件,运行即可修改
历史记录并提交到远程仓库。
2. [UEFI启动光盘镜像制作](grub)
- 支持UEFI启动的GRUB2 ISO光盘镜像的制作
\ No newline at end of file
+ 支持UEFI启动的GRUB2 ISO光盘镜像的制作
+3. [Telegram机器人推送P站图片](pixiv)
+ 爬取P站上的图片,并通过Telegram机器人推送到目标聊天室
\ No newline at end of file
diff --git a/pixiv/config.json.example b/pixiv/config.json.example
new file mode 100644
index 0000000..10bbec5
--- /dev/null
+++ b/pixiv/config.json.example
@@ -0,0 +1,8 @@
+{
+ "basePath": "本地缓存路径,包括接口数据,图片等",
+ "telegramToken": "telegram 机器人申请的API Token",
+ "chatId": "推送目标聊天的唯一标识符或目标频道的用户名",
+ "anonfilesToken": "https://anonfiles.com/ 申请的API Token",
+ "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/,分别是插画/动图/漫画",
+}
\ No newline at end of file
diff --git a/pixiv/pixiv.sh b/pixiv/pixiv.sh
new file mode 100644
index 0000000..f244359
--- /dev/null
+++ b/pixiv/pixiv.sh
@@ -0,0 +1,165 @@
+#!/bin/bash
+
+config_file=$1
+if [ -z $config_file ]
+then
+ echo 'The cache directory must be specified'
+ exit 1
+fi
+if [ ! -f $config_file ]
+then
+ echo 'config file:$config_file not found'
+ exit 1
+fi
+if [ ! -f `which jq` ]
+then
+ echo 'To run this script, you need to install jq,https://stedolan.github.io/jq/'
+ exit 1
+else
+ echo "jq version:`jq --version`"
+fi
+
+basePath=`cat $config_file|jq -r .basePath`
+if [ ! -f $basePath ]
+then
+ mkdir -p $basePath
+fi
+cd $basePath
+
+telegramToken=`cat $config_file | jq -r .telegramToken`
+baseApi="https://api.telegram.org/bot$telegramToken"
+chat_id=`cat $config_file | jq .chatId`
+mode=`cat $config_file | jq -r .mode`
+content=`cat $config_file | jq -r .content`
+rank_url="https://www.pixiv.net/ranking.php?mode=$mode&content=$content&p=1&format=json"
+today=`date "+%Y-%m-%d"`
+_today=`echo $today|sed -e 's/-/\\\\-/g'`
+rank_json=$today.json
+commands_file=$today.sh
+anonfiles_token=`cat $config_file | jq .anonfilesToken`
+touch $commands_file && chmod +x $commands_file
+sleep 30
+curl -v -d chat_id=$chat_id -d parse_mode=HTML -d text="Pixiv排行榜已更新,30秒后开始处理$today日榜数据。%0A%0A排名是什么?%0A排名是以pixiv上所有公开作品为对象的统计以及排名。%0A毎日0:00~23时59分59秒的阅览树・「赞!」数等为排名的依据,期结果由pixiv独自的算法「pixiv rank β」决定。统计结果于每日中午12:00公开。%0A有关排行榜" $baseApi/sendMessage
+
+if [ ! -f $rank_json ]
+then
+ echo "get data from $rank_url"
+ curl -v $rank_url >$rank_json
+fi
+length=`jq '.contents|length' $rank_json`
+fileCountSize=0
+maxSize=2500
+fileList=''
+media=''
+fileCount=0
+maxFileCount=10
+tarFile=$today.tar.gz
+originalFileList=''
+for index in `seq 1 $length`
+do
+ index=$((index-1))
+ pid=`jq --argjson index $index '.contents[$index].illust_id' $rank_json`
+ artworkLink="https://www.pixiv.net/artworks/$pid"
+ rank=`jq --argjson index $index '.contents[$index].rank' $rank_json`
+ yes_rank=`jq --argjson index $index '.contents[$index].yes_rank' $rank_json`
+ if [ $yes_rank -eq 0 ]
+ then
+ rank_info="#首次登场"
+ else
+ rank_info="\#rank$rank 之前 \#rank$yes_rank"
+ fi
+ echo "pid=$pid,artworkLink=$artworkLink,rank_info=$rank_info"
+ png_html_file=$pid.html
+ if [ ! -f $png_html_file ]
+ then
+ sleep 1
+ echo "get data from $artworkLink"
+ curl -v $artworkLink >$png_html_file
+ fi
+ json_file=$pid.json
+ if [ ! -f $json_file ]
+ then
+ egrep -o "content='{\"timestamp.*].{3}" $png_html_file | sed -e "s/content='//" >$json_file
+ fi
+ pageCount=`jq --arg pid $pid '.illust[$pid].pageCount' $json_file`
+ original_url=`jq --arg pid $pid '.illust[$pid].urls.original' $json_file | sed -e 's/\"//g'`
+ small_url=`jq --arg pid $pid '.illust[$pid].urls.small' $json_file | sed -e 's/\"//g'`
+ title=`jq -r --arg pid $pid '.illust[$pid].title' $json_file`
+ description=`jq -r --arg pid $pid '.illust[$pid].description' $json_file`
+ userName=`jq -r --arg pid $pid '.illust[$pid].userName' $json_file`
+ userId=`jq -r --arg pid $pid '.illust[$pid].userId' $json_file`
+ likeCount=`jq --arg pid $pid '.illust[$pid].likeCount' $json_file`
+ bookmarkCount=`jq --arg pid $pid '.illust[$pid].bookmarkCount' $json_file`
+ viewCount=`jq --arg pid $pid '.illust[$pid].viewCount' $json_file`
+ tag=`jq -r --arg pid $pid '.illust[$pid].tags.tags[].tag' $json_file|sed -e 's/^/\\#/g'|sed ':a;N;s/\n/ /;t a;'`
+
+ echo -e "pageCount=$pageCount,original_url=$original_url,small_url=$small_url\n\
+ title=$title,description=$description,userName=$userName\n\
+ likeCount=$likeCount,bookmarkCount=$bookmarkCount,viewCount=$viewCount\n\
+ tag=$tag"
+ for page in `seq 1 $pageCount`
+ do
+ page=$((page - 1))
+ page_original_url=`echo $original_url | sed -e "s/p0/p$page/"`
+ page_small_url=`echo $small_url | sed -e"s/p0/p$page/"`
+ original_file_name=`echo $page_original_url | egrep -o "$pid.*"`
+ small_file_name=`echo $page_small_url | egrep -o "$pid.*"`
+ echo "download image file name=$original_file_name,url=$page_original_url"
+ if [ ! -f $original_file_name ]
+ then
+ curl -v -H 'referer: https://www.pixiv.net/' $page_original_url -o $original_file_name
+ fi
+ originalFileList="$originalFileList $original_file_name"
+ echo "download image file name=$small_file_name,url=$page_small_url"
+ if [ ! -f $small_file_name ]
+ then
+ curl -v -H 'referer: https://www.pixiv.net/' $page_small_url -o $small_file_name
+ fi
+ if [ $page -eq 0 ]
+ then
+ media="$media,{\"type\":\"photo\",\"media\":\"attach://$small_file_name\",\"parse_mode\":\"HTML\",\"caption\":\"$rank_info\n$title\n$userName\n$tag\"}"
+ fileList=$fileList' -F '$small_file_name'=@'$basePath'/'$small_file_name
+ fileCount=$((fileCount + 1))
+ fileSize=`du $small_file_name | awk '{print $1}'`
+ fileCountSize=$((fileCountSize + fileSize))
+ echo "fileCountSize=$fileCountSize,fileCount=$fileCount"
+ fi
+ if [[ $fileCountSize -gt $maxSize || $fileCount -eq $maxFileCount ]]
+ then
+ echo "sleep 1m" >>$commands_file
+ echo "curl -v -F chat_id=$chat_id $fileList -F media='[`echo $media | cut -c 2-`]' $baseApi/sendMediaGroup" >>$commands_file
+ echo >>$commands_file
+ echo >>$commands_file
+ echo >>$commands_file
+ fileCountSize=0
+ fileList=''
+ media=''
+ fileCount=0
+ fi
+ done
+done
+if [ $fileCount -gt 0 ]
+then
+ echo "curl -v -F chat_id=$chat_id $fileList -F media='[`echo $media | cut -c 2-`]' $baseApi/sendMediaGroup" >>$commands_file
+fi
+sed -i '1d' $commands_file
+hasSend=$today.hasSend
+if [ ! -f $hasSend ]
+then
+ bash -c ./$commands_file
+ touch $hasSend
+fi
+
+if [ ! -f $tarFile ]
+then
+ tar -zcvf $tarFile $originalFileList
+fi
+uploadResFile=$today.upload
+if [ ! -f $uploadResFile ]
+then
+ curl -v -F "file=@$tarFile" -F token=$anonfiles_token https://api.anonfiles.com/upload -o $uploadResFile
+fi
+shortUrl=`cat $uploadResFile | jq -r .data.file.url.short`
+readable=`cat $uploadResFile | jq -r .data.file.metadata.size.readable|sed -e 's/\./\\\\./'`
+echo "shortUrl=$shortUrl,readable=$readable"
+curl -v -d text="$_today日榜原图($readable)已打包上传到服务器,[下载地址]($shortUrl) \#图包下载 \#资源下载 \#下载" -d chat_id=$chat_id -d parse_mode=MarkdownV2 $baseApi/sendMessage