Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Xtracter] How do you output multiple matches of an xpath? #3

Open
metaltermite opened this issue Mar 8, 2022 · 1 comment
Open

Comments

@metaltermite
Copy link

metaltermite commented Mar 8, 2022

Lets say you're trying to do xtract https://ubuntu.com "//h2"

Now, there are 36 matches for //h2 on ubuntu.com, but xtract will only return the first match.

I assumed perhaps the results were separated by a newline character, so I've tried, re s/\\n/-/gm [xtract https://ubuntu.com "//h2"] to replace all new lines, \n, with a dash, and it still only returns the first match.

Is there a way to show multiple xpath results with xtract? Am I doing something wrong?

Edit: Trying unions does not return multiple values either. xtract https://ubuntu.com "//h1 | //title" only returns the first match //h1 instead of both matches //h1 and //title in the union.

yellow added a commit that referenced this issue Mar 17, 2022
haven't tested
@yellow
Copy link
Owner

yellow commented Mar 17, 2022

Hello. I programmed this script to scrape basic information off of websites. The person who requested this plugin only needed information from a single tag. That's why you'll find the tag = tags[0] line.

1f096ad commit should fix this but I haven't tested the code. Please let me know so I can close this issue.

Thank you for using my plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants