Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[tool] Scrivere url su stdout: mDownURL
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Risorse italiane (documentazione e tools)
View previous topic :: View next topic  
Author Message
mouser
Veteran
Veteran


Joined: 10 Aug 2004
Posts: 1419
Location: Milano

PostPosted: Mon Jan 03, 2005 7:27 am    Post subject: [tool] Scrivere url su stdout: mDownURL Reply with quote

Buongiorno a tutti!!!!!

Ultimamente sto riprendendo in mano un po' di Java, e durante una lunga notte passata a rinfrescarmi la memoria in ufficio, ho partorito questo toolettino, che e' semplice-semplice ma potrebbe servire ogni tanto:

Il file .java:
http://mouser.altervista.org/java/mDownURL/mDownURL.java

Il file .class:
http://mouser.altervista.org/java/mDownURL/mDownURL.class

Semplicemente si becca una URL e la stampa sullo stdout, cosi' da poter redirigere l'output su di un file.
Questo simpaticissimo tool va utilizzato come segue:
Code:

$ java mDownURL http://www.google.it

E questo stampa in console il sito.
Per scaricare in un file di testo locale la pagina selezionata basta fare
Code:

$ java mDownURL http://www.google.it >> googleDown.txt


ps: chiedo a tutti di segnalarmi eventuali (anzi sicuri) bug e problemi vari. Non ho provato ad utilizzarlo perche' non ho a disposizione ne una linuxbox, ne tantomento la possibilita' di utlizzare le API java per connettermi ad un url (dannato firewall :evil: ). Ricondo che, nel caso qualcuno si azzardi a chiamare questa versione una alpha, ridero' fragorosamente, poiche' non credo che sia ancora a quel livello.

Ciriciao
mouser :wink:

edit: Mi sono dimenticato di ringraziare silian87 per l'aiuto datomi con una prima compilazione del codice. Grazie :D
Back to top
View user's profile Send private message
gutter
Bodhisattva
Bodhisattva


Joined: 13 Mar 2004
Posts: 7162
Location: Aarau, Aargau, Switzerland

PostPosted: Mon Jan 03, 2005 11:04 am    Post subject: Reply with quote

Ma da lo stesso risultato di:

Code:
wget -O - www.google.com


o non ho capito io?!?
_________________
Registered as User #281564 and Machines #163761
Back to top
View user's profile Send private message
silian87
Advocate
Advocate


Joined: 06 Oct 2003
Posts: 2318
Location: Treviso, Italy

PostPosted: Mon Jan 03, 2005 11:12 am    Post subject: Reply with quote

Credo che se e' cosi' allora basta usare:
Code:
curl www.google.it

_________________
Musica che ascolto: http://www.last.fm/user/silian87/

Silian87 FAQs: http://marentax.homelinux.org/~silian87/silian87-faq.txt

GTalk: silian87@gmail.com
Back to top
View user's profile Send private message
mouser
Veteran
Veteran


Joined: 10 Aug 2004
Posts: 1419
Location: Milano

PostPosted: Mon Jan 03, 2005 11:33 am    Post subject: Reply with quote

ehm.... :oops: mi sa che avete ragione.... :oops: :oops:

Purtroppo non usando molto internet, non ho mai avuto a che fare con questa tipologia di problema, non sapevo delle funzionalita' di wget e non conoscevo curl.

Allora mi sa che ho fatto proprio una gaff :oops:

Vabbe'....... uffa! faccio un tool, neanche lo provo ed e' gia' deprecato!!!!
mannaggia!!!!

Ciriciao
mouser :wink:
Back to top
View user's profile Send private message
=DvD=
Veteran
Veteran


Joined: 25 Mar 2004
Posts: 1353

PostPosted: Mon Jan 03, 2005 11:41 am    Post subject: Reply with quote

Se puo aiutarti non lo conoscevo nemmeno io curl!
Back to top
View user's profile Send private message
silian87
Advocate
Advocate


Joined: 06 Oct 2003
Posts: 2318
Location: Treviso, Italy

PostPosted: Mon Jan 03, 2005 11:44 am    Post subject: Reply with quote

LOL :lol:

cmq curl l'ho conosciuto su opendarwin. Offre piu' o meno le stesse funzionalita' di wget, ma di default redirige sullo stdout. Imho wget e' sempre il migliore.
_________________
Musica che ascolto: http://www.last.fm/user/silian87/

Silian87 FAQs: http://marentax.homelinux.org/~silian87/silian87-faq.txt

GTalk: silian87@gmail.com
Back to top
View user's profile Send private message
gutter
Bodhisattva
Bodhisattva


Joined: 13 Mar 2004
Posts: 7162
Location: Aarau, Aargau, Switzerland

PostPosted: Mon Jan 03, 2005 11:51 am    Post subject: Reply with quote

mouser wrote:

[CUT]
Allora mi sa che ho fatto proprio una gaff :oops:

Vabbe'....... uffa! faccio un tool, neanche lo provo ed e' gia' deprecato!!!!
mannaggia!!!!
[CUT]


Non te la prendere io non volevo assolutamente sminuire il tuo lavoro. :D

La mi era solo una domanda per vedere se le funzionalità dei tool erano le stesse.
_________________
Registered as User #281564 and Machines #163761
Back to top
View user's profile Send private message
mouser
Veteran
Veteran


Joined: 10 Aug 2004
Posts: 1419
Location: Milano

PostPosted: Mon Jan 03, 2005 11:56 am    Post subject: Reply with quote

una domanda a voi utlizzatori di curl e wget.

Suppongo sia possibile fare con wget un
Code:

# wget -O - www.google.com | grep <regexp>

vero???

Stavo scrivendo, sempre per rinfrescarmi la memoria, un tool (che per ora si chiama wgrep) che permette di fare un grep sia su alcune pagine web (tipo www.google.com) ma anche su gruppi di pagine (per esempio un wgrep su mouser.altervista.org/java/ <regexp> cercherebbe in tutti i file e nelle sotto dir le voci che rispondono alla regexp).

Credete possa interessare?

Ciriciao (e grazie per il feedback)
mouser :wink:
Back to top
View user's profile Send private message
gutter
Bodhisattva
Bodhisattva


Joined: 13 Mar 2004
Posts: 7162
Location: Aarau, Aargau, Switzerland

PostPosted: Mon Jan 03, 2005 12:01 pm    Post subject: Reply with quote

Non sono sicuro di aver capito bene :)

Mi spieghi magari con un esempio cosa dovrebbe fare questo tool.
_________________
Registered as User #281564 and Machines #163761
Back to top
View user's profile Send private message
Tiro
l33t
l33t


Joined: 14 Feb 2003
Posts: 752
Location: italy

PostPosted: Mon Jan 03, 2005 12:11 pm    Post subject: Reply with quote

io adoro:

Code:
$ curl www.google.it | html2text #opp.
html2text pagina.html
Back to top
View user's profile Send private message
mouser
Veteran
Veteran


Joined: 10 Aug 2004
Posts: 1419
Location: Milano

PostPosted: Mon Jan 03, 2005 12:14 pm    Post subject: Reply with quote

Allora...

Questo tool, chiamato wgrep praticamente fa su pagine web quello che fa grep sull'input passatogli.

Ti faccio un paio di esempi, per farti capire anche se i siti riportati nell'esempio non esistono:
Code:

# wgrep Ciao www.saluti.it
http://www.saluti.it: <LI> <A HREF="prova.html">Ciao</A>

e questo e' per esempio il risultato della ricerca sul sito www.saluti.it: ha trovato una corrispondenza di "Ciao" su quella pagina, e stampa la riga nella quale e' riportata.

Se lo lancio su una directory web, magari con piu' file all'interno posso ottenere una ricerca su tutti i file (e quindi le pagine in quella webdir) e, inoltre su tutte le directory sottostanti. Quindi
Code:

# wgrep Ciao www.saluti.it/varie/
http://www.saluti.it/varie/ciao.html: <TITLE>Ciao, come stai</TITLE>
http://www.saluti.it/varie/ciao.html: <h1> E questa e' Ciao</h1>
http://www.saluti.it/varie/esempio/prova.txt: Questa riga esce cercando Ciao come regexp


Spero di essere stato un po' piu' chiaro... comunque, se non oggi, magari domani metto online il tool, cosi' potete provarlo e vedere se puo' servire.

Ciriciao
mouser :wink:
Back to top
View user's profile Send private message
Tiro
l33t
l33t


Joined: 14 Feb 2003
Posts: 752
Location: italy

PostPosted: Mon Jan 03, 2005 1:06 pm    Post subject: Reply with quote

ok...capito... ;)
Back to top
View user's profile Send private message
gutter
Bodhisattva
Bodhisattva


Joined: 13 Mar 2004
Posts: 7162
Location: Aarau, Aargau, Switzerland

PostPosted: Mon Jan 03, 2005 5:43 pm    Post subject: Reply with quote

Penso che con un wget e con grep otterrai lo stesso risultato.
_________________
Registered as User #281564 and Machines #163761
Back to top
View user's profile Send private message
mouser
Veteran
Veteran


Joined: 10 Aug 2004
Posts: 1419
Location: Milano

PostPosted: Tue Jan 04, 2005 6:19 am    Post subject: Reply with quote

gutter wrote:
Penso che con un wget e con grep otterrai lo stesso risultato.


Anche su piu' file appartenenti a quel sito?
Oppure devo fare wget per ogni pagina?
Sai, se ci sono 50 pagine html e devo cercare tutte le ricorrenze di una determinata parola, a meno che anche wget non supporti questa cosa, lanciare 50 wget mi costa un pelino di piu' che lanciare un mio wgrep.
Purtroppo non so utilizzare bene wget e quindi devo continuare a spillare informazioni dalle tue esperienze.

Ciriciao
mouser :wink:
Back to top
View user's profile Send private message
gutter
Bodhisattva
Bodhisattva


Joined: 13 Mar 2004
Posts: 7162
Location: Aarau, Aargau, Switzerland

PostPosted: Tue Jan 04, 2005 10:06 am    Post subject: Reply with quote

Credo che basti usare:

Code:
$ wget -r -np -O - www.tuosito.com | grep <parola>


Non ho provato, ma penso che sia circa quello che vuoi tu ;)
_________________
Registered as User #281564 and Machines #163761
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Risorse italiane (documentazione e tools) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum