def updateInfo(self, item, newlinks, oldlinks):
		'''爬虫爬完之后对数据库内容进行更新'''
		cur = self.conn.cursor()
		cur.execute("SELECT wid,did FROM Websites WHERE url=?", (item['url'],))
		wid, did = cur.fetchone()
		# website记录更新
		cur.execute("UPDATE Websites SET title=?,visited=1 WHERE wid=?", (item['title'], wid,))
		# 对应的domain记录中出度也需要更新
		cur.execute("UPDATE Domains SET outdegree=outdegree+? WHERE did=?", (len(item['links']), did,))

		# 对该网页中所有链接涉及的记录进行更新
		# 外部判断未出现过的链接
		for link,domain in newlinks:
			self.insertWebsite(link, domain)

		# 外部判断出现过的链接
		for link,domain in oldlinks:
			# 对对应的domain记录入度增加
			cur.execute("UPDATE Domains SET outdegree=outdegree+1 WHERE domain=?", (domain,))
		# 写入到文件
		self.conn.commit()
def insert(self, path, matchrecursive=True, globpats=None, repats=None):
        """Insert a directory path to this tree.

        If matchrecursive is True, mark the directory as unconditionally
        include files and subdirs recursively.

        If globpats or repats are specified, append them to the patterns being
        applied at this directory. The tricky part is those patterns can match
        "x/y/z" and visit("x"), visit("x/y") need to return True, while we
        still want visit("x/a") to return False.
        """
        if path == "":
            self.matchrecursive |= matchrecursive
            if globpats:
                # Need to match parent directories too.
                for pat in globpats:
                    components = _globpatsplit(pat)
                    parentpat = ""
                    for comp in components:
                        if parentpat:
                            parentpat += "/"
                        parentpat += comp
                        if "/" in comp:
                            # Giving up - fallback to slow paths.
                            self.unsurerecursive = True
                        self._globdirpats.append(parentpat)
                if any("**" in p for p in globpats):
                    # Giving up - "**" matches paths including "/"
                    self.unsurerecursive = True
                self._kindpats += [("glob", pat, "") for pat in globpats]
            if repats:
                if not all(map(_testrefastpath, repats)):
                    # Giving up - fallback to slow paths.
                    self.unsurerecursive = True
                self._kindpats += [("re", pat, "") for pat in repats]
            return

        subdir, rest = self._split(path)
        self.setdefault(subdir, _tree()).insert(rest, matchrecursive, globpats, repats)