diff --git a/.gitignore b/.gitignore index 287a2f0..af67964 100644 --- a/.gitignore +++ b/.gitignore @@ -112,7 +112,6 @@ ipython_config.py # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm __pypackages__/ - # Celery stuff celerybeat-schedule celerybeat.pid diff --git a/example1.py b/example1.py deleted file mode 100644 index d2456d7..0000000 --- a/example1.py +++ /dev/null @@ -1,29 +0,0 @@ -import requests -import json -from bs4 import BeautifulSoup -import re - - -def bvid2cid(bvid): # 获取视频cid - url = "https://api.bilibili.com/x/player/pagelist?bvid=" + str(bvid) + "&jsonp=jsonp" - r = requests.get(url) - dirt = json.loads(r.text) - cid = dirt['data'][0]['cid'] - return cid - - -def cid2data(cid): - url = 'https://api.bilibili.com/x/v1/dm/list.so?oid=' + str(cid) - r = requests.get(url=url) - r.encoding = 'utf-8' - html = BeautifulSoup(r.text, 'html5lib') - ds = html.find_all('d') - said = '.*">(.*).*' - for d in ds: - with open(str(cid) + '.txt', 'a', encoding='utf-8') as f: - f.write(re.findall(said, str(d))[0] + '\n') - - -cid = bvid2cid('BV1gp4y1e7cE') -cid2data(cid) - diff --git a/requirements.txt b/requirements.txt index 278d25b..402f488 100644 Binary files a/requirements.txt and b/requirements.txt differ