mark.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. from set_mark.start import start
  2. import re
  3. import html
  4. import sqlite3
  5. from urllib import parse
  6. import time
  7. import threading
  8. def send_parser(data):
  9. data = html.escape(data)
  10. javascript = re.compile('javascript:', re.I)
  11. data = javascript.sub('', data)
  12. data = re.sub('&lt;a href="(?:[^"]*)"&gt;(?P<in>(?:(?!&lt;).)*)&lt;\/a&gt;', '<a href="' + parse.quote('\g<in>').replace('/','%2F') + '">\g<in></a>', data)
  13. return data
  14. def plusing(conn, name, link, backtype):
  15. curs = conn.cursor()
  16. curs.execute("select title from back where title = ? and link = ? and type = ?", [link, name, backtype])
  17. if not curs.fetchall():
  18. curs.execute("insert into back (title, link, type) values (?, ?, ?)", [link, name, backtype])
  19. def namumark(conn, title, data, num, in_c, toc_y):
  20. data = start(conn, data, title)
  21. # if num == 1:
  22. # for d4 in backlink:
  23. # t = threading.Thread(target = plusing, args = [conn, d4[0], d4[1], d4[2]])
  24. # t.start()
  25. # t.join()
  26. #
  27. # conn.commit()
  28. return data