From aa151acaa3ee2ecb4a603aa82f87019a42dc2508 Mon Sep 17 00:00:00 2001 From: lxfly2000 Date: Sat, 10 Aug 2019 19:31:29 +0800 Subject: [PATCH] Fix AcFun Bangumi download. --- README.md | 2 +- src/you_get/extractors/acfun.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e1551c9a..360b5d0b 100644 --- a/README.md +++ b/README.md @@ -403,7 +403,7 @@ Use `--url`/`-u` to get a list of downloadable resource URLs extracted from the | **niconico
ニコニコ動画** | |✓| | | | **163
网易视频
网易云音乐** |
|✓| |✓| | 56网 | |✓| | | -| **AcFun** | |✓| | | +| **AcFun** | |✓| | | | **Baidu
百度贴吧** | |✓|✓| | | 爆米花网 | |✓| | | | **bilibili
哔哩哔哩** | |✓| | | diff --git a/src/you_get/extractors/acfun.py b/src/you_get/extractors/acfun.py index 3dacedf5..61f6cae8 100644 --- a/src/you_get/extractors/acfun.py +++ b/src/you_get/extractors/acfun.py @@ -124,10 +124,11 @@ def acfun_download(url, output_dir='.', merge=True, info_only=False, **kwargs): # bangumi elif re.match("https?://[^\.]*\.*acfun\.[^\.]+/bangumi/ab(\d+)", url): html = get_content(url) - title = match1(html, r'"title"\s*:\s*"([^"]+)"') - if match1(url, r'_(\d+)$'): # current P - title = title + " " + r1(r'active">([^<]*)', html) - vid = match1(html, r'videoId="(\d+)"') + tag_script = match1(html, r'') + json_text = tag_script[tag_script.find('{') : tag_script.find('};') + 1] + json_data = json.loads(json_text) + title = json_data['bangumiTitle'] + " " + json_data['episodeName'] + " " + json_data['title'] + vid = str(json_data['videoId']) up = "acfun" else: raise NotImplemented @@ -148,6 +149,6 @@ def acfun_download(url, output_dir='.', merge=True, info_only=False, **kwargs): **kwargs) -site_info = "AcFun.tv" +site_info = "AcFun.cn" download = acfun_download download_playlist = playlist_not_supported('acfun')