                     
                     (head,foot) = try String(contentsOf:url!).contains(string: "<span class=\"all hidden\">") ? ("<span class=\"all hidden\">","</span>") : ("<span property=\"v:summary\" class=\"\">","</span>")
                     
-                    _ = self.scanWith(head:head,foot:foot,scanner:scanner).components(separatedBy: "<br />").map{
+                    _ = self.scanWith(data:data,head:head,foot:foot).first!.components(separatedBy: "<br />").map{
                         intro += $0.trimmingCharacters(in: .whitespacesAndNewlines)
                     }
                     
                     
-                    doMongoDB
+                    doMongoDB{
+                        
+                        let selector = try BSON(json:"{\"id\":\(id)}")
+                        //数据已满
+                        if let count = $0.find()?.reversed().count,count > 9
                         {
-                            let selector = try BSON(json:"{\"id\":\(id)}")
-                            //数据已满
-                            if let count = $0.find()?.reversed().count,count > 9
+                            for x in $0.find(query: selector)!
                             {
-                                for x in $0.find(query: selector)!
-                                {
-                                    if x.asString.isEmpty { serverPush.shared.beginPush() }
-                                }
+                                if x.asString.isEmpty { serverPush.shared.beginPush() }
                             }
-                            else
+                        }
+                        else
+                        {
+                            if case .success = $0.update(selector: selector, update: try BSON(json: "{\"id\":\(id),\"content\":{\(content)},\"intro\":\"\(intro)\"}"), flag: .upsert) {} else
                             {
-                                if case .success = $0.update(selector: selector, update: try BSON(json: "{\"id\":\(id),\"content\":{\(content)},\"intro\":\"\(intro)\"}"), flag: .upsert) {} else
-                                {
-                                    throw crawlerError(msg: "数据保存有误")
-                                }
+                                throw crawlerError(msg: "数据保存有误")
                             }
+                        }
                     }
                 }
                 catch

        for case let url in data.map({ URL(string:$0) })
        {
            guard let _ = url else { throw crawlerError(msg:"数据\(index)初始化失败") }

            Threading.getQueue(name: "sync", type: .serial).dispatch
            {
                do
                {
                    let scanner = Scanner(string: try String(contentsOf:url!))
                    var (head,foot) = ("data-name=",".jpg")
                    
                    //电影模型
                    var tempStr = (head + self.scanWith(head:head,foot:foot,scanner:scanner) + foot).components(separatedBy: "data-").map{
                        "\"\($0)".replacingOccurrences(of: "=", with: "\":").trim(string:" ")
                    }
                    


#if os(Linux)
    import SwiftGlibc
#endif

import Foundation
import PerfectThread
import MongoDB
import PerfectLogger

