Script
This chapter introduces the basic use of scripts. The script is defined in JSON format and can be easily deserialized in various languages.
Conversion method
import crawlipt as cpt
# During the writing phase, Python built-in dictionary types can be used for writing
script = {
"method": "redirect",
"url": "https://www.baidu.com/",
"next": {
"method": "input", # Method name
"xpath": "//*[@id=\"kw\"]", # Method corresponding parameters
"text": "baidu tieba", # Method corresponding parameters
"next": { # Next script to execute
"method": "click",
"xpath": "//*[@id=\"su\"]"
}
}
}
# Convert to a JSON string, which can be stored in a physical medium
script_json = cpt.Script.generate_json(script) Execute Script
Introduction to Script initialization parameters
parameter name
type
introduction
Introduction to Script Executor Parameters
parameter name
type
introduction
Writing scripts through list step method
Last updated