Skip to content

Commit 5e2ae39

Browse files
authored
提示需要安装 node.js
1 parent c8fa546 commit 5e2ae39

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

douyin_pro_2.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from contextlib import closing
33
import requests, json, re, os, sys, random
44
from ipaddress import ip_address
5+
from subprocess import Popen, PIPE
56

67
class DouYin(object):
78
def __init__(self, width = 500, height = 300):
@@ -51,7 +52,11 @@ def get_video_urls(self, user_id):
5152
dytk = _dytk_re.search(share_user.text).group(1)
5253
print('签名JS下载中')
5354
self.video_downloader('https://raw.githubusercontent.com/loadchange/amemv-crawler/master/fuck-byted-acrawler.js', 'fuck-byted-acrawler.js')
54-
singer = os.popen('node fuck-byted-acrawler.js %s' % uid)
55+
try:
56+
process = Popen(['node', 'fuck-byted-acrawler.js', str(uid)], stdout=PIPE, stderr=PIPE)
57+
except (OSError, IOError) as err:
58+
print('请先安装 node.js: https://nodejs.org/')
59+
sys.exit()
5560
sign = singer.readlines()[0]
5661
user_url = 'https://www.amemv.com/aweme/v1/aweme/post/?user_id=%s&max_cursor=0&count=%s&aid=1128&_signature=%s&dytk=%s' % (uid, aweme_count, sign, dytk)
5762
req = requests.get(user_url, headers=self.headers)

0 commit comments

Comments
 (0)