File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ import requests
2
+ import json
3
+ #多p:https://www.acfun.cn/v/ac3202810_4
4
+ #单p:https://www.acfun.cn/v/ac12607834
5
+ url = 'https://www.acfun.cn/v/ac3202810_4'
6
+ headers = {'user-agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.122 Safari/537.36' }
7
+ rec = requests .get (url ,headers = headers )
8
+ #print(rec.text)
9
+
10
+ cutjson = rec .text
11
+ str1 = cutjson .find ('window.pageInfo = window.videoInfo = ' )
12
+ str2 = cutjson .find ('window.qualityConfig =' )
13
+ videoinfo = cutjson [str1 + 37 :str2 - 10 ]
14
+ j = json .loads (videoinfo )
15
+
16
+ print (j ['title' ])
17
+ print (j ['description' ])
18
+
19
+ if len (j ['videoList' ]) == 1 :
20
+ #单p
21
+ #print(j['currentVideoInfo']['ksPlayJson'])
22
+
23
+ j2 = json .loads (j ['currentVideoInfo' ]['ksPlayJson' ])
24
+ for index in range (len (j2 )):
25
+ print (j2 ['adaptationSet' ]['representation' ][index ]['qualityType' ])
26
+ print (j2 ['adaptationSet' ]['representation' ][index ]['url' ])
27
+ print ('**********' * 30 )
28
+ else :
29
+ #duop
30
+ for index in range (len (j ['videoList' ])):
31
+ print (j ['videoList' ][index ]['title' ])
32
+ print (j ['currentVideoInfo' ]['ksPlayJson' ])
You can’t perform that action at this time.
0 commit comments