使用 xpath 和电报即时视图提取、创建和附加

Extract, create and append using xpath and telegram instant view

<iframe src="https://expmle.com/subdirectory/sample_title" />

我如何使用 XPath 和 [=] createappend 下面的 <a> 标签16=]函数?

<a href="https://expmle.com/subdirectory/sample_title">sample_title</a>

我想提取整个 src 最后一部分 并使用它们创建 <a> 标签。

如有任何建议,我们将不胜感激:)

这应该可以正常工作。

<a>: //iframe # Find iframe and convert it to <a>

@set_attr(href, ./@src) # Set href attribute from src

$anchor # Create variable for current <a>
@set_attr(text, ./@href) # We set new attribute for link which will processed by @match function, then @text attribute will be replaced by result of the @match
@match("\w+_\w+"): $@/@text # Now we find our future name of the link "sample_name" (this function will replace all in @text by our new name

@prepend(@text): $anchor # And then put this name to his $anchor
# append <a> tag below
@after(<a>, href, ./@src, content, ./@src): //iframe

# take everything after the last slash
@match("[^\/]+$", "1"): $@/@content

# move the attribute inside the tag
@append(@content): $@

如果最后一个$@不行,就为<a>定义一个变量。