相关操作
如何寻找oid
- 按F12,点击展开
- 点击查看历史弹幕,点击日期
- 找到含有oid的url
完整代码
import requests
import pandas as pd
import json
import os
import time
import re
from datetime import datetime
header = {
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36",
"Cookie":"你的B站账号cookie",
"origin": "https://www.bilibili.com",
"referer": "https://www.bilibili.com/"
}
url = r'https://www.bilibili.com/video/BV1Vt411i7kb/'
oid = 67049681
res= requests.get(url,headers=header)
text = res.text
title = re.findall(r'<h1 title="(.*?)"',text)[0]
date = re.findall(r"<span>(\d{4})-(\d\d)-(\d\d) \d\d:\d\d:\d\d</span>",text)[0