Пример #1
0
def main():
    sql_commiter = SqlManager({
        "logger": None,
        "get_object_fun": lambda pkg: pkg.threads
    })

    thread_obj = FourChanThread(
        input_dict={
            "is_pinned": False,
            "op_content": "OP Content",
            "post_datetime": datetime.datetime.now(),
            "image_content": "",
            "abbreviated": False,
            "body_cut_off": False,
            "post_num": "1020471246",
            "link": "URL"
        })

    pkg = Package()
    pkg.threads = [thread_obj]

    sql_commiter.scrape_from_url("", pkg)
Пример #2
0
                    self.logger.debug(data_package.threads[i].link +
                                      " is not malicious.")

                data_package.threads[i].is_malicious = is_malicious

        else:
            raise AttributeError("The config dict for " + str(self.__class__) +
                                 " must contain an attribute 'get_text_flag'.")


if __name__ == "__main__":
    config = {
        "get_text_method":
        lambda package: [
            thread.op_content for thread in package.threads
            if not thread.body_cut_off
        ],
        "logger":
        centipede_logger.create_logger("DetectMaliceInText", logging.DEBUG)
    }
    detect_malice_limb = DetectMaliceInText(config)

    package = Package()
    package.threads = [
        FourChanThread({
            "op_content":
            "If you live in wichita ks dont come to school tomorrow"
        })
    ]

    detect_malice_limb.scrape_from_url("", package)