|
@@ -3,9 +3,10 @@ from set_mark.namu import namu
|
|
|
import re
|
|
import re
|
|
|
import html
|
|
import html
|
|
|
import sqlite3
|
|
import sqlite3
|
|
|
-from urllib import parse
|
|
|
|
|
|
|
+import urllib.parse
|
|
|
import time
|
|
import time
|
|
|
import threading
|
|
import threading
|
|
|
|
|
+import multiprocessing
|
|
|
|
|
|
|
|
def load_conn2(data):
|
|
def load_conn2(data):
|
|
|
global conn
|
|
global conn
|
|
@@ -21,33 +22,36 @@ def send_parser(data):
|
|
|
javascript = re.compile('javascript:', re.I)
|
|
javascript = re.compile('javascript:', re.I)
|
|
|
|
|
|
|
|
data = javascript.sub('', data)
|
|
data = javascript.sub('', data)
|
|
|
- data = re.sub('<a href="(?:(?:(?!").)*)">(?P<in>(?:(?!<).)*)<\/a>', '<a href="' + parse.quote('\g<in>').replace('/','%2F') + '">\g<in></a>', data)
|
|
|
|
|
|
|
+ data = re.sub('<a href="(?:(?:(?!").)*)">(?P<in>(?:(?!<).)*)<\/a>', '<a href="' + urllib.parse.quote('\g<in>').replace('/','%2F') + '">\g<in></a>', data)
|
|
|
|
|
|
|
|
return data
|
|
return data
|
|
|
|
|
|
|
|
-def plusing(name, link, backtype):
|
|
|
|
|
- curs.execute("select title from back where title = ? and link = ? and type = ?", [link, name, backtype])
|
|
|
|
|
- if not curs.fetchall():
|
|
|
|
|
- curs.execute("insert into back (title, link, type) values (?, ?, ?)", [link, name, backtype])
|
|
|
|
|
|
|
+def plusing(data):
|
|
|
|
|
+ for data_in in data:
|
|
|
|
|
+ curs.execute("select title from back where title = ? and link = ? and type = ?", [data_in[1], data_in[0], data_in[2]])
|
|
|
|
|
+ if not curs.fetchall():
|
|
|
|
|
+ curs.execute("insert into back (title, link, type) values (?, ?, ?)", [data_in[1], data_in[0], data_in[2]])
|
|
|
|
|
|
|
|
def namumark(title = '', data = '', num = 0):
|
|
def namumark(title = '', data = '', num = 0):
|
|
|
if not data == '':
|
|
if not data == '':
|
|
|
data = namu(conn, data, title, num)
|
|
data = namu(conn, data, title, num)
|
|
|
|
|
|
|
|
if num == 1:
|
|
if num == 1:
|
|
|
- i = 0
|
|
|
|
|
- while 1:
|
|
|
|
|
- try:
|
|
|
|
|
- _ = data[2][i][0]
|
|
|
|
|
- except:
|
|
|
|
|
- break
|
|
|
|
|
-
|
|
|
|
|
- thread_start = threading.Thread(target = plusing, args = [data[2][i][0], data[2][i][1], data[2][i][2]])
|
|
|
|
|
|
|
+ data_num = len(data[2])
|
|
|
|
|
+ data_in_num = int(data_num / 8)
|
|
|
|
|
+ data_in = []
|
|
|
|
|
+
|
|
|
|
|
+ for i in range(8):
|
|
|
|
|
+ if not i == 7:
|
|
|
|
|
+ data_in += [data[2][data_in_num * i:data_in_num * (i + 1)]]
|
|
|
|
|
+ else:
|
|
|
|
|
+ data_in += [data[2][data_in_num * i:]]
|
|
|
|
|
+
|
|
|
|
|
+ for data_in_for in data_in:
|
|
|
|
|
+ thread_start = threading.Thread(target = plusing, args = [data_in_for])
|
|
|
thread_start.start()
|
|
thread_start.start()
|
|
|
thread_start.join()
|
|
thread_start.join()
|
|
|
-
|
|
|
|
|
- i += 1
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
conn.commit()
|
|
conn.commit()
|
|
|
|
|
|
|
|
return data[0] + data[1]
|
|
return data[0] + data[1]
|