diff --git a/.travis.yml b/.travis.yml index c11cbe34..735a6d91 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,15 +6,20 @@ python: - "3.4" - "3.5" - "3.6" - - "3.7-dev" - - "nightly" - "pypy3" +matrix: + include: + - python: "3.7" + dist: xenial + - python: "3.8-dev" + dist: xenial + - python: "nightly" + dist: xenial before_install: - if [[ $TRAVIS_PYTHON_VERSION != '3.2'* && $TRAVIS_PYTHON_VERSION != '3.3'* ]]; then pip install flake8; fi before_script: - - if [[ $TRAVIS_PYTHON_VERSION != '3.2'* && $TRAVIS_PYTHON_VERSION != '3.3'* ]]; then flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics; fi + - if [[ $TRAVIS_PYTHON_VERSION != '3.2'* && $TRAVIS_PYTHON_VERSION != '3.3'* ]]; then flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics; fi script: make test -sudo: false notifications: webhooks: urls: diff --git a/src/you_get/extractors/baidu.py b/src/you_get/extractors/baidu.py index d3744f9d..7914667e 100644 --- a/src/you_get/extractors/baidu.py +++ b/src/you_get/extractors/baidu.py @@ -38,7 +38,7 @@ def baidu_get_song_title(data): def baidu_get_song_lyric(data): lrc = data['lrcLink'] - return None if lrc is '' else "http://music.baidu.com%s" % lrc + return "http://music.baidu.com%s" % lrc if lrc else None def baidu_download_song(sid, output_dir='.', merge=True, info_only=False): diff --git a/src/you_get/extractors/douyutv.py b/src/you_get/extractors/douyutv.py index bdcea458..82ea5c4d 100644 --- a/src/you_get/extractors/douyutv.py +++ b/src/you_get/extractors/douyutv.py @@ -62,12 +62,12 @@ def douyutv_download(url, output_dir='.', merge=True, info_only=False, **kwargs) json_content = json.loads(content) data = json_content['data'] server_status = json_content.get('error', 0) - if server_status is not 0: + if server_status != 0: raise ValueError("Server returned error:%s" % server_status) title = data.get('room_name') show_status = data.get('show_status') - if show_status is not "1": + if show_status != "1": raise ValueError("The live stream is not online! (Errno:%s)" % server_status) real_url = data.get('rtmp_url') + '/' + data.get('rtmp_live') diff --git a/src/you_get/extractors/panda.py b/src/you_get/extractors/panda.py index ba6f2b4e..c9af4b38 100644 --- a/src/you_get/extractors/panda.py +++ b/src/you_get/extractors/panda.py @@ -15,7 +15,7 @@ def panda_download(url, output_dir = '.', merge = True, info_only = False, **kwa json_request_url ="http://www.panda.tv/api_room_v2?roomid={}&__plat=pc_web&_={}".format(roomid, int(time.time())) content = get_html(json_request_url) api_json = json.loads(content) - + errno = api_json["errno"] errmsg = api_json["errmsg"] if errno: @@ -25,7 +25,7 @@ def panda_download(url, output_dir = '.', merge = True, info_only = False, **kwa room_key = data["videoinfo"]["room_key"] plflag = data["videoinfo"]["plflag"].split("_") status = data["videoinfo"]["status"] - if status is not "2": + if status != "2": raise ValueError("The live stream is not online! (status:%s)" % status) data2 = json.loads(data["videoinfo"]["plflag_list"]) @@ -33,7 +33,7 @@ def panda_download(url, output_dir = '.', merge = True, info_only = False, **kwa sign = data2["auth"]["sign"] ts = data2["auth"]["time"] real_url = "http://pl{}.live.panda.tv/live_panda/{}.flv?sign={}&ts={}&rid={}".format(plflag[1], room_key, sign, ts, rid) - + print_info(site_info, title, 'flv', float('inf')) if not info_only: download_urls([real_url], title, 'flv', None, output_dir, merge = merge) diff --git a/src/you_get/extractors/zhibo.py b/src/you_get/extractors/zhibo.py index 1d2eadea..a6143c30 100644 --- a/src/you_get/extractors/zhibo.py +++ b/src/you_get/extractors/zhibo.py @@ -14,7 +14,7 @@ def zhibo_vedio_download(url, output_dir = '.', merge = True, info_only = False, video_html = r1(r'', html) - # video_guessulike = r1(r"window.xgData =([s\S'\s\.]*)\'\;[\s\S]*window.vouchData", video_html) + # video_guessulike = r1(r"window.xgData =([s\S'\s\.]*)\'\;[\s\S]*window.vouchData", video_html) video_url = r1(r"window.vurl = \'([s\S'\s\.]*)\'\;[\s\S]*window.imgurl", video_html) part_urls.append(video_url) ext = video_url.split('.')[-1] @@ -34,7 +34,7 @@ def zhibo_download(url, output_dir = '.', merge = True, info_only = False, **kwa html = get_html(url) title = r1(r'([\s\S]*)', html) is_live = r1(r"window.videoIsLive=\'([s\S'\s\.]*)\'\;[\s\S]*window.resDomain", html) - if is_live is not "1": + if is_live != "1": raise ValueError("The live stream is not online! (Errno:%s)" % is_live) match = re.search(r"""