This commit is contained in:
richard 2020-04-07 23:45:32 -04:00
parent bd06317fcc
commit 84a5611939
5 changed files with 56 additions and 2 deletions

View File

@ -436,6 +436,7 @@ Use `--url`/`-u` to get a list of downloadable resource URLs extracted from the
| 火猫TV | <http://www.huomao.com/> |✓| | |
| 阳光宽频网 | <http://www.365yg.com/> |✓| | |
| 西瓜视频 | <https://www.ixigua.com/> |✓| | |
| 新片场 | <https://www.xinpianchang.com//> |✓| | |
| 快手 | <https://www.kuaishou.com/> |✓|✓| |
| 抖音 | <https://www.douyin.com/> |✓| | |
| TikTok | <https://www.tiktok.com/> |✓| | |

View File

@ -116,6 +116,7 @@ SITES = {
'xiaokaxiu' : 'yixia',
'xiaojiadianvideo' : 'fc2video',
'ximalaya' : 'ximalaya',
'xinpianchang' : 'xinpianchang',
'yinyuetai' : 'yinyuetai',
'yizhibo' : 'yizhibo',
'youku' : 'youku',

View File

@ -79,10 +79,11 @@ from .vk import *
from .w56 import *
from .wanmen import *
from .xiami import *
from .xinpianchang import *
from .yinyuetai import *
from .yixia import *
from .youku import *
from .youtube import *
from .zhanqi import *
from .zhibo import *
from .zhihu import *
from .zhihu import *

View File

@ -0,0 +1,46 @@
#!/usr/bin/env python
import re
import json
from ..extractor import VideoExtractor
from ..common import get_content, playlist_not_supported
class Xinpianchang(VideoExtractor):
stream_types = [
{'id': '4K', 'quality': '超清 4K', 'video_profile': 'mp4-4K'},
{'id': '2K', 'quality': '超清 2K', 'video_profile': 'mp4-2K'},
{'id': '1080', 'quality': '高清 1080P', 'video_profile': 'mp4-FHD'},
{'id': '720', 'quality': '高清 720P', 'video_profile': 'mp4-HD'},
{'id': '540', 'quality': '清晰 540P', 'video_profile': 'mp4-SD'},
{'id': '360', 'quality': '流畅 360P', 'video_profile': 'mp4-LD'}
]
name = 'xinpianchang'
def prepare(self, **kwargs):
# find key
page_content = get_content(self.url)
match_rule = r"vid: \"(.+?)\","
key = re.findall(match_rule, page_content)[0]
# get videos info
video_url = 'https://openapi-vtom.vmovier.com/v3/video/' + key + '?expand=resource'
data = json.loads(get_content(video_url))
self.title = data["data"]["video"]["title"]
video_info = data["data"]["resource"]["progressive"]
# set streams dict
for video in video_info:
url = video["https_url"]
size = video["filesize"]
profile = video["profile_code"]
stype = [st for st in self.__class__.stream_types if st['video_profile'] == profile][0]
stream_data = dict(src=[url], size=size, container='mp4', quality=stype['quality'])
print(stream_data)
self.streams[stype['id']] = stream_data
download = Xinpianchang().download_by_url
download_playlist = playlist_not_supported('xinpianchang')

View File

@ -8,7 +8,8 @@ from you_get.extractors import (
youtube,
missevan,
acfun,
bilibili
bilibili,
xinpianchang
)
@ -45,5 +46,9 @@ class YouGetTests(unittest.TestCase):
bilibili.download(
"https://www.bilibili.com/watchlater/#/av74906671/p6", info_only=True
)
def test_xinpianchang(self):
imgur.download('https://www.xinpianchang.com/a10673220', info_only=True)
if __name__ == '__main__':
unittest.main()