-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.py
50 lines (33 loc) · 954 Bytes
/
start.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#! python
# -*- coding: utf-8 -*-
from flask import Flask, request, redirect
# from urllib import request as frequest
# from multiprocessing import Process
import os
app = Flask(__name__)
# def down(url):
# with frequest.urlopen(url) as f:
# with open('123', 'wb') as wf:
# wf.write(f.read())
def runDown(url):
# print(123)
# p = Process(target=down, args=(url,))
# p.start()
print('\n\n\n-----------------------------------')
os.system('wget -P ../down/ ' + url + ' > ./log/down.log')
@app.route('/wg', methods=['POST'])
def downUrl():
if request.method == 'POST':
url = request.form.get('url')
runDown(url)
return 'Hello World! ' + url + '\n'
@app.route('/js')
def js():
return redirect('http://wget.vlper.top/log/down.js')
@app.route('/')
def hello_world():
return 'Hello World! \n'
def main_():
app.run(port=8080)
if __name__ == '__main__':
main_()