Skip to content

Commit

Permalink
更新
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengfan2014 committed Mar 8, 2020
1 parent d0a4dff commit 5886491
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions step1/acfun-video.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import requests
import json
#多p:https://www.acfun.cn/v/ac3202810_4
#单p:https://www.acfun.cn/v/ac12607834
url = 'https://www.acfun.cn/v/ac3202810_4'
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'}
rec = requests.get(url,headers=headers)
#print(rec.text)

cutjson = rec.text
str1 = cutjson.find('window.pageInfo = window.videoInfo = ')
str2 = cutjson.find('window.qualityConfig =')
videoinfo = cutjson[str1+37:str2-10]
j = json.loads(videoinfo)

print(j['title'])
print(j['description'])

if len(j['videoList']) == 1:
#单p
#print(j['currentVideoInfo']['ksPlayJson'])

j2 = json.loads(j['currentVideoInfo']['ksPlayJson'])
for index in range(len(j2)):
print(j2['adaptationSet']['representation'][index]['qualityType'])
print(j2['adaptationSet']['representation'][index]['url'])
print('**********'*30)
else:
#duop
for index in range(len(j['videoList'])):
print(j['videoList'][index]['title'])
print(j['currentVideoInfo']['ksPlayJson'])
Empty file added step1/bangumi.py
Empty file.

0 comments on commit 5886491

Please sign in to comment.