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

Selector combination don't work as expected #190

Open
mszet opened this issue Jul 21, 2023 · 5 comments
Open

Selector combination don't work as expected #190

mszet opened this issue Jul 21, 2023 · 5 comments

Comments

@mszet
Copy link

mszet commented Jul 21, 2023

Get Links that start with "vivaldi-stable_6" and end in "_amd64.deb" according the last example in MDN

$ baseurl='https://repo.vivaldi.com/stable/deb/pool/main/'
$ curl -s "$baseurl" |pup 'a[href^=vivaldi-stable_6][href$=_amd64.deb] attr{href}'
vivaldi-stable_6.1.3035.111-1_amd64.deb
vivaldi-stable_6.1.3035.111-1_arm64.deb
vivaldi-stable_6.1.3035.111-1_armhf.deb

Thank you for your attention.
Greetings, mszet

@gromgit
Copy link

gromgit commented Jul 25, 2023

Which version of pup are you using? Chaining attribute selectors works fine for me:

$ pup --version
0.4.0

$ baseurl='https://repo.vivaldi.com/stable/deb/pool/main/'

$ curl -s "$baseurl" |pup 'a[href^=vivaldi-stable_6] attr{href}'
vivaldi-stable_6.1.3035.111-1_amd64.deb
vivaldi-stable_6.1.3035.111-1_arm64.deb
vivaldi-stable_6.1.3035.111-1_armhf.deb
vivaldi-stable_6.1.3035.204-1_amd64.deb
vivaldi-stable_6.1.3035.204-1_arm64.deb
vivaldi-stable_6.1.3035.204-1_armhf.deb

$ curl -s "$baseurl" |pup 'a[href^=vivaldi-stable_6][href$=_amd64.deb] attr{href}'
vivaldi-stable_6.1.3035.111-1_amd64.deb
vivaldi-stable_6.1.3035.204-1_amd64.deb

@mszet
Copy link
Author

mszet commented Jul 25, 2023

Which version of pup are you using? Chaining attribute selectors works fine for me:
$ pup --version
0.4.0

It is the same from debian bookworm.
Now i have cloned and compiled myself, but the result remains the same:

$git clone https://github.com/ericchiang/pup.git
Klone nach 'pup'...
remote: Enumerating objects: 952, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 952 (delta 0), reused 3 (delta 0), pack-reused 947
Empfange Objekte: 100% (952/952), 3.78 MiB | 8.71 MiB/s, fertig.
Löse Unterschiede auf: 100% (346/346), fertig.

$ cd pup
$ go build .
go: downloading github.com/fatih/color v1.0.0
go: downloading github.com/mattn/go-colorable v0.0.5
go: downloading golang.org/x/text v0.0.0-20160719205907-0a5a09ee4409
go: downloading github.com/mattn/go-isatty v0.0.0-20151211000621-56b76bdf51f7

$ ls -l ./pup
-rwxr-xr-x 1 michael michael 3710054 25. Jul 13:51 ./pup

$ baseurl='https://repo.vivaldi.com/stable/deb/pool/main/'
$ curl -s "$baseurl" |./pup 'a[href^=vivaldi-stable_6][href$=_amd64.deb] attr{href}'
vivaldi-stable_6.1.3035.111-1_amd64.deb
vivaldi-stable_6.1.3035.111-1_arm64.deb
vivaldi-stable_6.1.3035.111-1_armhf.deb
vivaldi-stable_6.1.3035.204-1_amd64.deb
vivaldi-stable_6.1.3035.204-1_arm64.deb
vivaldi-stable_6.1.3035.204-1_armhf.deb

Thank you for your attention.
Greetings, mszet

@gromgit
Copy link

gromgit commented Aug 11, 2023

Not sure what happened there, but since you have a local source directory, try updating the dependencies (which were last bumped almost a year ago):

go get -u
go mod tidy
go build .

then try your test again.

@mszet
Copy link
Author

mszet commented Aug 11, 2023

No changes:

$ go get -u
go: downloading golang.org/x/net v0.14.0
go: downloading github.com/mattn/go-colorable v0.1.13
go: downloading github.com/fatih/color v1.15.0
go: downloading golang.org/x/text v0.12.0
go: downloading github.com/mattn/go-isatty v0.0.19
go: downloading golang.org/x/sys v0.0.0-20160717071931-a646d33e2ee3
go: downloading golang.org/x/sys v0.11.0
go: upgraded github.com/fatih/color v1.0.0 => v1.15.0
go: upgraded github.com/mattn/go-colorable v0.0.5 => v0.1.13
go: upgraded github.com/mattn/go-isatty v0.0.0-20151211000621-56b76bdf51f7 => v0.0.19
go: upgraded golang.org/x/net v0.0.0-20160720084139-4d38db76854b => v0.14.0
go: upgraded golang.org/x/sys v0.0.0-20160717071931-a646d33e2ee3 => v0.11.0
go: upgraded golang.org/x/text v0.0.0-20160719205907-0a5a09ee4409 => v0.12.0

$ go mod tidy
$ go build .

$ baseurl='https://repo.vivaldi.com/stable/deb/pool/main/'
$ curl -s "$baseurl" |./pup 'a[href^=vivaldi-stable_6][href$=_amd64.deb] attr{href}'
vivaldi-stable_6.1.3035.111-1_amd64.deb
vivaldi-stable_6.1.3035.111-1_arm64.deb
vivaldi-stable_6.1.3035.111-1_armhf.deb
vivaldi-stable_6.1.3035.204-1_amd64.deb
vivaldi-stable_6.1.3035.204-1_arm64.deb
vivaldi-stable_6.1.3035.204-1_armhf.deb
vivaldi-stable_6.1.3035.257-1_amd64.deb
vivaldi-stable_6.1.3035.257-1_arm64.deb
vivaldi-stable_6.1.3035.257-1_armhf.deb

What system are you using?

Thank you for your attention.
Greetings, mszet

@gromgit
Copy link

gromgit commented Aug 11, 2023

Ubuntu 22.04, but I just realized that I've been testing against my own fork instead of the original source. 😀

This was addressed by #139, so you'll want to pull it into your own fork. If you don't have your own fork, patch the original source as follows:

curl -sL "https://github.com/ericchiang/pup/commit/f9e1b3ed7dfa615dd5709c6aa78aab2c7c63c190.patch" | patch -p1

then build and try again.

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