Skip to content

Commit

Permalink
Update douyin.py
Browse files Browse the repository at this point in the history
  • Loading branch information
steven7851 authored Dec 24, 2019
1 parent e714684 commit 0126240
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions douyin/douyin.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ def get_video_urls(self, user_id, type_flag='f'):
while req.status_code != 200:
req = requests.post(sign_api, data=data)
sign = req.json().get('signature')
user_url_prefix = 'https://www.douyin.com/aweme/v1/aweme/favorite' if type_flag == 'f' else 'https://www.douyin.com/aweme/v1/aweme/post'
user_url_prefix = 'https://www.douyin.com/web/api/v2/aweme/like' if type_flag == 'f' else 'https://www.douyin.com/web/api/v2/aweme/post'
print('解析视频链接中')
while has_more != 0:
user_url = user_url_prefix + '/?user_id=%s&max_cursor=%s&count=21&aid=1128&_signature=%s&dytk=%s' % (user_id, max_cursor, _sign, dytk)
user_url = user_url_prefix + '/?user_id=%s&sec_uid=&count=21&max_cursor=%s&aid=1128&_signature=%s&dytk=%s' % (user_id, max_cursor, sign, dytk)
req = requests.get(user_url, headers=self.headers)
while req.status_code != 200:
req = requests.get(user_url, headers=self.headers)
Expand Down Expand Up @@ -146,8 +146,8 @@ def run(self):
watermark_flag = input('是否下载带水印的视频 (0-否(默认), 1-是):')
watermark_flag = watermark_flag if watermark_flag!='' else '0'
watermark_flag = bool(int(watermark_flag))
type_flag = input('f-收藏的(默认), p-上传的:')
type_flag = type_flag if type_flag!='' else 'f'
type_flag = input('收藏的目前无法下载 f-收藏的, p-上传的(默认):')
type_flag = type_flag if type_flag!='' else 'p'
save_dir = input('保存路径 (例如"E:/Download/", 默认"./Download/"):')
save_dir = save_dir if save_dir else "./Download/"
video_names, video_urls, share_urls, nickname = self.get_video_urls(user_id, type_flag)
Expand Down

0 comments on commit 0126240

Please sign in to comment.