avatar

目录
B站番剧列表获取

B站番剧列表获取方式


这个是B站某页番剧列表的API地址

https://api.bilibili.com/pgc/season/index/result?season_version=-1&area=-1&is_finish=-1&copyright=-1&season_status=-1&season_month=-1&year=-1&style_id=-1&order=3&st=1&sort=0&page=页数&season_type=1&pagesize=20&type=1

  请求方式:get

  返回格式:json

主要标签

  • badge:观看限制(免费/会员专享/付费)

  • link:番剧地址

  • order:追番人数

  • title:番剧名

  • cover:番剧封面

  • index_show:番剧话数


简易的写个python爬取这些json文件

python
#引入一大堆的巴拉巴拉
import json
import threading
import time
import requests
#爬取B站番剧列表
from bs4 import BeautifulSoup
def man():
#循环次数,看你要爬多少页,要爬取全部那就写个获取页数的函数赋值或者手动加上去
for page in range(1,152):
#转格式
num = str(page)
#获取js数据
getup = requests.get('https://api.bilibili.com/pgc/season/index/result?season_version=-1&area=-1&is_finish=-1&copyright=-1&season_status=-1&season_month=-1&year=-1&style_id=-1&order=3&st=1&sort=0&page=' + num + '&season_type=1&pagesize=20&type=1')
#转码
getup.encoding = 'utf-8'
#创建json并写入数据(注意修改文件夹)
timedate = "C:/xxx/"+num+".json"
print (timedate)
file = open(timedate,"w",encoding = 'utf-8')
file.write(getup.text)
print("完成爬取")
#延时控制,比如这就是两秒爬取1页
#time.sleep(2)
#完成爬取
print ("year~")

某页的json文件

json
{"code":0,"data":{"has_next":1,"list":[{"badge":"","badge_type":0,"cover":"http://i0.hdslb.com/bfs/bangumi/0406cd1398ad8ae0e9623bed5544d6002d8d30be.jpg","index_show":"全13话","is_finish":1,"link":"https://www.bilibili.com/bangumi/play/ss1539","media_id":1539,"order":"256.2万追番","order_type":"fav_count","season_id":1539,"title":"我的青春恋爱物语果然有问题。","title_icon":""},{"badge":"","badge_type":0,"cover":"http://i0.hdslb.com/bfs/bangumi/bdcab81683bf4f048de4fa4fe0754c3650e93fea.jpg","index_show":"全12话","is_finish":1,"link":"https://www.bilibili.com/bangumi/play/ss6440","media_id":6440,"order":"252.2万追番","order_type":"fav_count","season_id":6440,"title":"如果能写小说就好了","title_icon":""},{"badge":"付费观看","badge_type":2,"cover":"http://i0.hdslb.com/bfs/bangumi/140bacf044bb0c0841bd1f0e4fc682d037f73f88.jpg","index_show":"全13话","is_finish":1,"link":"https://www.bilibili.com/bangumi/play/ss21464","media_id":8772,"order":"251.9万追番","order_type":"fav_count","season_id":21464,"title":"Fate/EXTRA Last Encore","title_icon":""},{"badge":"会员专享","badge_type":0,"cover":"http://i0.hdslb.com/bfs/bangumi/e2b46584e29f2349748b48c5fb26ce02fcbca4e8.jpg","index_show":"全12话","is_finish":1,"link":"https://www.bilibili.com/bangumi/play/ss5058","media_id":5058,"order":"251.4万追番","order_type":"fav_count","season_id":5058,"title":"路人超能100(灵能百分百)","title_icon":""},{"badge":"","badge_type":0,"cover":"http://i0.hdslb.com/bfs/bangumi/7bf8baf33c1ecd4a7fea91e81d0143aabe1e1b7c.jpg","index_show":"全24话","is_finish":1,"link":"https://www.bilibili.com/bangumi/play/ss687","media_id":687,"order":"251.1万追番","order_type":"fav_count","season_id":687,"title":"樱花庄的宠物女孩","title_icon":""},{"badge":"","badge_type":0,"cover":"http://i0.hdslb.com/bfs/bangumi/85ecf86a69c6f337ec7762922471eaf63020b26f.jpg","index_show":"全24话","is_finish":1,"link":"https://www.bilibili.com/bangumi/play/ss963","media_id":963,"order":"250.8万追番","order_type":"fav_count","season_id":963,"title":"魔法禁书目录 第一季","title_icon":""},{"badge":"会员专享","badge_type":0,"cover":"http://i0.hdslb.com/bfs/bangumi/65f89e0a0d050ff987159829fcf565faae199d08.png","index_show":"全12话","is_finish":1,"link":"https://www.bilibili.com/bangumi/play/ss26281","media_id":5267750,"order":"249.4万追番","order_type":"fav_count","season_id":26281,"title":"约定的梦幻岛","title_icon":""},{"badge":"","badge_type":0,"cover":"http://i0.hdslb.com/bfs/bangumi/7ec9487f007c278733212908a6f607e4a245b1d4.jpg","index_show":"全22话","is_finish":1,"link":"https://www.bilibili.com/bangumi/play/ss1588","media_id":1588,"order":"248万追番","order_type":"fav_count","season_id":1588,"title":"罪恶王冠","title_icon":""},{"badge":"会员专享","badge_type":0,"cover":"http://i0.hdslb.com/bfs/bangumi/image/ae05a72b11d7f409bbff9475afb13dfca081ffd1.jpg","index_show":"全24话","is_finish":1,"link":"https://www.bilibili.com/bangumi/play/ss27993","media_id":28221387,"order":"246.3万追番","order_type":"fav_count","season_id":27993,"title":"Dr.STONE 石纪元","title_icon":""},{"badge":"会员专享","badge_type":0,"cover":"http://i0.hdslb.com/bfs/bangumi/ce55ba2772db23fcf816ac7f82afc2f6eb2c26c9.png","index_show":"全14话","is_finish":1,"link":"https://www.bilibili.com/bangumi/play/ss27995","media_id":28221390,"order":"244.7万追番","order_type":"fav_count","season_id":27995,"title":"平凡职业造就世界最强","title_icon":""},{"badge":"","badge_type":0,"cover":"http://i0.hdslb.com/bfs/bangumi/152c536f8ecaad8f3d7d568d33da81c963a4a722.png","index_show":"全12话","is_finish":1,"link":"https://www.bilibili.com/bangumi/play/ss23850","media_id":78352,"order":"243.8万追番","order_type":"fav_count","season_id":23850,"title":"超能力女儿","title_icon":""},{"badge":"","badge_type":0,"cover":"http://i0.hdslb.com/bfs/bangumi/6603936f61460f284c153b5fbdf2a8f6b2acb34c.jpg","index_show":"全12话","is_finish":1,"link":"https://www.bilibili.com/bangumi/play/ss3494","media_id":3494,"order":"240.6万追番","order_type":"fav_count","season_id":3494,"title":"甲铁城的卡巴内瑞","title_icon":""},{"badge":"会员专享","badge_type":0,"cover":"http://i0.hdslb.com/bfs/bangumi/5ce66f68d54052e3a305524b9b06a76977e974fc.jpg","index_show":"全12话","is_finish":1,"link":"https://www.bilibili.com/bangumi/play/ss5989","media_id":5989,"order":"238.7万追番","order_type":"fav_count","season_id":5989,"title":"月色真美","title_icon":""},{"badge":"会员抢先","badge_type":0,"cover":"http://i0.hdslb.com/bfs/bangumi/image/0318e1b5349c7c3714846723f6b64a50dc0b49ac.png","index_show":"更新至第8话","is_finish":0,"link":"https://www.bilibili.com/bangumi/play/ss29342","media_id":28224120,"order":"238.4万追番","order_type":"fav_count","season_id":29342,"title":"地缚少年花子君","title_icon":""},{"badge":"","badge_type":0,"cover":"http://i0.hdslb.com/bfs/bangumi/a57b2da42518f7f496a75fd4cccae781c5346df7.jpg","index_show":"全13话","is_finish":1,"link":"https://www.bilibili.com/bangumi/play/ss4340","media_id":4340,"order":"237.3万追番","order_type":"fav_count","season_id":4340,"title":"中二病也要谈恋爱!","title_icon":""},{"badge":"会员专享","badge_type":0,"cover":"http://i0.hdslb.com/bfs/bangumi/ade6781efe9cdfd7e40cba2d6e34381287efa634.jpg","index_show":"全12话","is_finish":1,"link":"https://www.bilibili.com/bangumi/play/ss28002","media_id":28221399,"order":"236.1万追番","order_type":"fav_count","season_id":28002,"title":"某科学的一方通行","title_icon":""},{"badge":"会员专享","badge_type":0,"cover":"http://i0.hdslb.com/bfs/bangumi/745b04054e591da4f4172923a7d51de3dddb4288.jpg","index_show":"全11话","is_finish":1,"link":"https://www.bilibili.com/bangumi/play/ss23856","media_id":78512,"order":"235.5万追番","order_type":"fav_count","season_id":23856,"title":"阿宅的恋爱真难","title_icon":""},{"badge":"会员专享","badge_type":0,"cover":"http://i0.hdslb.com/bfs/bangumi/216e1bdaf88244215a13b1154116805ee9adbe07.png","index_show":"全13话","is_finish":1,"link":"https://www.bilibili.com/bangumi/play/ss26297","media_id":4762734,"order":"233.6万追番","order_type":"fav_count","season_id":26297,"title":"路人超能100 II(灵能百分百 第二季)","title_icon":""},{"badge":"会员专享","badge_type":0,"cover":"http://i0.hdslb.com/bfs/bangumi/2673ac643b48eb5bda64c960a2ca850fbebb839d.jpg","index_show":"全11话","is_finish":1,"link":"https://www.bilibili.com/bangumi/play/ss5550","media_id":5550,"order":"233.3万追番","order_type":"fav_count","season_id":5550,"title":"夏目友人帐 伍","title_icon":""},{"badge":"会员专享","badge_type":0,"cover":"http://i0.hdslb.com/bfs/bangumi/d3ce7564ddf58b2f7245b104fb578a5655e55168.jpg","index_show":"全13话","is_finish":1,"link":"https://www.bilibili.com/bangumi/play/ss1660","media_id":1660,"order":"233万追番","order_type":"fav_count","season_id":1660,"title":"夏目友人帐","title_icon":""}],"num":4,"size":20,"total":3032},"message":"success"}
打赏
  • 微信
    微信
  • 支付宝
    支付宝

评论