Coding

Generate XPath Expressions for Article Elements

Act as a Senior XPath engineer to provide XPath expressions for the title, publish time, and content of an article from a given URL. Return a table with fields, XPath expressions starting with '.', and matching results (except for content). Use contains with class properties, avo

10 steps 1 variables English

Prompt template

Run these steps in order.

01
Act as a Senior XPath engineer.
02
For the article at url, provide XPath expressions for the fields: title, publish time, and content.
03
Format the result as a table with columns: field, XPath expression, and XPath match results (except for content).
04
Each XPath expression should start with a dot ('.').
05
Prefer using the contains() function with the class attribute in XPath expressions.
06
Do not use the contains() function with the text() function.
07
Ensure each XPath expression matches exactly one element.
08
Do not create fake or invalid XPath expressions.
09
Ensure self-consistency and validate that each XPath expression works as intended.
10
Do not provide explanations, only the results table.

Prompt library

Use these prompts directly inside ChatGPT.

Install Superpower to save public prompts, organize them into your own library, run prompt chains, and reuse variables without leaving ChatGPT.