-
Notifications
You must be signed in to change notification settings - Fork 1
166 lines (150 loc) · 6.53 KB
/
kboxjson.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: kboxjson
on:
schedule:
- cron: '8 */8 * * *'
workflow_dispatch:
jobs:
my-job:
name: My Job
runs-on: ubuntu-latest
environment:
name: github-pages
steps:
- uses: actions/checkout@v2
- name: Fetch JSON
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
URLMK: ${{ secrets.URLMK }}
WWW: ${{ secrets.WWW }}
GATEWAY: ${{ secrets.GATEWAY }}
FMSERVICERETRY: ${{ secrets.FMSERVICERETRY }}
run: |
function waitForJobs() {
runningJobs=$(jobs -pr | wc -l)
while [ "$runningJobs" -gt "$1" ]; do
echo "Waiting for ${runningJobs} -> $1 Jobs"
#jobs -r | wc -l | tr -d " "
runningJobs=$(jobs -pr | wc -l)
sleep 1
done
}
[ -d fmlist ] || mkdir fmlist
pagesize=1
pageindex=1
urllist="$URLMK/fmList.php?pagesize=$pagesize&pageindex=$pageindex";
jsonlist=$(curl -s "$urllist")
[[ $jsonlist == \"* ]] && jsonlist=$(eval echo "$jsonlist")
main="def main():
import sys, json
print(json.load(sys.stdin)['recordcount'])"
py=$(echo -e "$main\nmain()")
#echo $py
pagesize=$(echo "$jsonlist" | python3 -c "$py")
echo $pagesize
urllist="$URLMK/fmList.php?pagesize=$pagesize&pageindex=$pageindex"
jsonlist=$(curl -s "$urllist")
[[ $jsonlist == \"* ]] && jsonlist=$(eval echo "$jsonlist")
echo $jsonlist > "fmlist/$pageindex.json"
urllist="$WWW/fmweb/html/index.html"
jsonlist=$(curl -s -4 "$urllist"|grep 'var radioData = '|sed 's/^var radioData = /{"data":/;s/;$/}/')
echo "$jsonlist" > "fmlist.json"
#echo "$jsonlist"
main="def main():
import sys, json
fmlist=json.load(sys.stdin)
for fm in fmlist['data']:
print(fm['fmid'])"
py=$(echo -e "$main\nmain()")
#echo "$jsonlist"
#echo "$py"
loop="YES"
count=0
for fmid in $(echo "$jsonlist" | python3 -c "$py")
do
[ -z $loop ] && break
waitForJobs 22
count=$((count+1))
echo "fmid=$fmid $count/$pagesize"
offset="0"
for offset in {0..600..20}
do
[ -z $loop ] && break
function fmserviceretrySongs(){
#$FMSERVICERETRY/v1/app_song_list_offset?dfid=4WWbsd4ayqvC0diIQl2sB5Fx
#{"uid":"0","appid":"1005","clientver":"10259","mid":"283772038997640891902313795880766264264","clienttime":"1649117508","key":"24d3bf3d4c6fdd1834691aa355ddcf0d","ishq":0,"area_code":"1","data":[{"fmid":"5","singername":"中文经典","fmtype":"2","offset":"1","size":19}],"get_tracker":1}
#{"uid":"0","appid":"1005","clientver":"10259","mid":"283772038997640891902313795880766264264","clienttime":"1649143065","key":"291945d5873cd1cfd9e1c37c7e63b03b","ishq":0,"area_code":"1","data":[{"fmid":"11","singername":"轻音乐","fmtype":"2","offset":"","size":19}],"get_tracker":1}
urlsongs="$FMSERVICERETRY/v1/app_song_list_offset"
clienttime=$(date +%s)
postdata='{"appid":"1005","clientver":"10259","mid":"283772038997640891902313795880766264264","clienttime":"1649117508","key":"24d3bf3d4c6fdd1834691aa355ddcf0d","data":[{"fmid":"'$fmid'","fmtype":"2","offset":"'$offset'","size":20}]}'
#echo "$postdata"
jsonsongs=$(curl -v -X POST "$urlsongs" -H 'Content-Type: application/json' -d "$postdata")
[[ $jsonsongs == \"* ]] && jsonsongs=$(eval echo "$jsonsongs")
if echo "$jsonsongs" | grep -q '"songs":\[{'; then
[ -d "fmserviceretry/$fmid" ] || mkdir -p "fmserviceretry/$fmid"
echo "$jsonsongs" > "fmserviceretry/$fmid/$offset.json"
fi
}
#fmserviceretrySongs &
function gatewaySongs(){
#$URLMK/fmSongs.php?size=20&fmid=$fmid&offset=$offset
#offset=$(grep -o 'offset[^,]*\",' "$fsongs" |grep -o '%7B.*%7D')n
urlsongs="$GATEWAY/openapicdn/broadcast/v2/get_songlist?radio_id=$fmid&offset=$offset&pagesize=20"
jsonsongs=$(curl -s "$urlsongs")
[[ $jsonsongs == \"* ]] && jsonsongs=$(eval echo "$jsonsongs")
main="def main():
import sys, json
fmsongs=json.load(sys.stdin)
if fmsongs['data']['songlist'] is None:
print("0")
else:
print(len(fmsongs['data']['songlist']))"
py=$(echo -e "$main\nmain()")
lensongs=$(echo "$jsonsongs" | python3 -c "$py")
#echo "offset=$offset len=$lensongs"
if [ "$lensongs" -gt "0" ]; then
[ -d "gateway/$fmid" ] || mkdir -p "gateway/$fmid"
echo $jsonsongs > "gateway/$fmid/$offset.json"
#if echo "$jsonhash" | grep -q '"error":"您操作太频繁了,请稍后再试"'; then
# loop=""
# echo "QUIT"
#fi
#sleep 10
fi
}
gatewaySongs &
done
done
waitForJobs 0
curl -k -o bing.json "https://bing.com/HPImageArchive.aspx?format=js&idx=0&n=8"
curl -k -o pixabay.json "${{ secrets.PIXABAY }}"
if [ $? -eq 0 ]; then
sed -i 's|\"largeImageURL"|\"_largeImageURL"|g' pixabay.json
sed -i 's|\"previewURL"|\"largeImageURL"|g' pixabay.json
sed -i 's|\_150.jpg|\_960_720.jpg|g' pixabay.json
fi
curl -k -o vladstudio.json "https://vlad.studio/api/v3/art/?client=${{ secrets.VLADSTUDIO }}&format=json&has_wall=1&limit=600"
if [ $? -eq 0 ]; then
sed -i 's|api\\\/v3\\\/download?client=.\{24\}&filename=|wallpaper-image\\\/|g' vladstudio.json
sed -i 's|\&size|?size|g' vladstudio.json
fi
curl -k -o unsplash.json "${{ secrets.UNSPLASH }}1"
if [ $? -eq 0 ]; then
for p in 2 3 4 5 6 ; do
curl -k -o unsplash_tmp.json "${{ secrets.UNSPLASH }}$p"
if [ $? -eq 0 ]; then
json=$(cat unsplash.json)
json=${json%*\]}
tmp=$(cat unsplash_tmp.json)
tmp=${tmp#*\[}
echo "$json,$tmp" > unsplash.json
fi
done
fi
- name: Cleanup
run: |
rm -f upload.txt
rm -f unsplash_tmp.json
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Action Auto"