MCPcopy
hub / github.com/Jack-Cherish/python-spider / run

Method run

douyin.py:92–117  ·  view source on GitHub ↗

运行函数 Parameters: None Returns: None

(self)

Source from the content-addressed store, hash-verified

90
91
92 def run(self):
93 """
94 运行函数
95 Parameters:
96 None
97 Returns:
98 None
99 """
100 self.hello()
101 # user_id = input('请输入ID(例如13978338):')
102 user_id = 'sm666888'
103 video_names, video_urls, nickname = self.get_video_urls(user_id)
104 if nickname not in os.listdir():
105 os.mkdir(nickname)
106 sys.stdout.write('视频下载中:\n')
107 for num in range(len(video_urls)):
108 print(' %s\n' % video_urls[num])
109 video_url = self.get_download_url(video_urls[num])
110 if '\\' in video_names[num]:
111 video_name = video_names[num].replace('\\', '')
112 elif '/' in video_names[num]:
113 video_name = video_names[num].replace('/', '')
114 else:
115 video_name = video_names[num]
116 self.video_downloader(video_url, os.path.join(nickname, video_name))
117 print('')
118
119 def hello(self):
120 """

Callers 2

douyin.pyFile · 0.45
downVideoFunction · 0.45

Calls 5

helloMethod · 0.95
get_video_urlsMethod · 0.95
get_download_urlMethod · 0.95
video_downloaderMethod · 0.95
replaceMethod · 0.80

Tested by

no test coverage detected