xRalf
asked on
wget link autocompletion
Hello,
is there a way that wget complete links (or give a few often alternatives) when I press tab? Similarly as
bash shell, but it should complete links.
Could you show me how to achieve this?
thanks
is there a way that wget complete links (or give a few often alternatives) when I press tab? Similarly as
bash shell, but it should complete links.
Could you show me how to achieve this?
thanks
You would need to write your own bash extension that would dynamically and asynchronously fetch a sitemap with all the urls for that domain (i.e. http://example.com/sitemap.xml), parse it, and then load that into an array or existing class that supports auto-completion. It wouldn't be easy for me, maybe for others - Good luck!
ASKER
Thank you for answer,
maybe somebody has written the bash extension already but we don't know it's name or how to find it.
maybe somebody has written the bash extension already but we don't know it's name or how to find it.
I believe it's quite unlikely. Although you have similar things on wikipedia and goole, this is only because there is one backend that provides such data.
As wget can connect to ANY http or ftp address, so, expect some theoretical possibility, there is no practical way to achieve this. Another problem is you need the information back from the site instantly or near-instantly so... no way. Not yet at least.
As wget can connect to ANY http or ftp address, so, expect some theoretical possibility, there is no practical way to achieve this. Another problem is you need the information back from the site instantly or near-instantly so... no way. Not yet at least.
ASKER
This is difficult question. I increased points and made the question easier as follows.
It's sufficient that the bash is able to autocomplete address that are already in firefox history.
It's sufficient that the bash is able to autocomplete address that are already in firefox history.
Just to confirm, you are wanting to input in a Linux command line after you type 'wget ' and then see URL's auto-complete (matching against FireFox's history) by starting to type and press tab?
If I understand correctly, this is likely going to require some c. You may want to consider re-posting this question in a c and linux zones; the ones you are using presently are not going to address that low level functionality.
If I understand correctly, this is likely going to require some c. You may want to consider re-posting this question in a c and linux zones; the ones you are using presently are not going to address that low level functionality.
The ncftp ftp client can do tab completion on remote file names. Also it bookmarks every site as you visit it for the first time, so you only have to input the address once ever. But it is an ftp client, not http (as wget is)
In order for wget to do command line tab autocompletion it would have to connect to the server (assuming that the server is completely entered) and somehow via http get a list of all links in the appropriate directory. Unfortunately, there is no standard way to do a directory listing via http. In fact in some cases it is actually impossible to return any kind of meaningful directory listing because the local URLs might not have a manageable correspondence with files on the disk, and each of an infinite set of filenames could point to unique automatically generated content.
ASKER
It's sufficient as I described in comment number 34222150
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
sed -e 's/^\(http.*\/\)\(.*\)/mkd ir -p '\''\1'\''; touch '\''\1\2'\''/'
turns that URL above into the two commands above.
Cheers,
-Jon
P.S. There are no double quotes in the above - those are a bunch of single quotes.
turns that URL above into the two commands above.
Cheers,
-Jon
P.S. There are no double quotes in the above - those are a bunch of single quotes.
ASKER
Thank you The--Captain
for very original and great solution.
Could you help with two things yet?
I can't find the location of firefox history file.
Here is described http://www.linuxforums.org/forum/newbie/127046-storing-history-file-mozila-firefox-fedora-7-a.html that it should be in history.dat which is not on my system (Xubuntu)
Where should be created the dummy directory structure and files? In the root directory?
Is it possible somewhere it doesn't get in the way?
for very original and great solution.
Could you help with two things yet?
I can't find the location of firefox history file.
Here is described http://www.linuxforums.org/forum/newbie/127046-storing-history-file-mozila-firefox-fedora-7-a.html that it should be in history.dat which is not on my system (Xubuntu)
Where should be created the dummy directory structure and files? In the root directory?
Is it possible somewhere it doesn't get in the way?
"Where should be created the dummy directory structure and files? In the root directory?"
Just create a new directory somewhere and just put all the dummy filesystem stuff in there.
Run a locate or find for bookmarks.html to find the file. If you need help parsing it, you might want to open another question specifically dedicated to that.
Cheers,
-Jon
Just create a new directory somewhere and just put all the dummy filesystem stuff in there.
Run a locate or find for bookmarks.html to find the file. If you need help parsing it, you might want to open another question specifically dedicated to that.
Cheers,
-Jon
ASKER
Thank you "locate" found it. I will try to parse and if needed I will open another question.
I've got an idea to download with curl the whole page and extract more links from that, so it will be able to do more completions, but I should probably restrict it for domain, because it could be infinite...
I've got an idea to download with curl the whole page and extract more links from that, so it will be able to do more completions, but I should probably restrict it for domain, because it could be infinite...
ASKER
But those are bookmarks.html. I have problem with finding history file.
I tried
locate history | grep irefox
I returned only formhistory.sqlite
I tried
locate history | grep irefox
I returned only formhistory.sqlite
You're right - I forgot that you wanted history, not bookmarks. I think the file you're looking for is called places.sqlite , but I don't know off the top of my head the layout - you'd probably have to search online (or ask a new question right here at EE) to find a way to use sqlite off the command line to dump the URLs.
Cheers,
-Jon
Cheers,
-Jon
ASKER
Thanks a lot.
I asked another question https://www.experts-exchange.com/questions/26678910/How-to-parse-firefox-history-in-Linux.html
I asked another question https://www.experts-exchange.com/questions/26678910/How-to-parse-firefox-history-in-Linux.html
wget expects a link as a parameter. It's not aware of it's location or it's contents until you completely tell him the URL.