您需要一個可編寫腳本的(無頭文件)瀏覽器。下面是使用PhantomJS一個JavaScript例如:
// resource_logger.js
var page = require('webpage').create();
page.onResourceRequested = function(request) {
console.log(request.url);
};
page.open('http://www.fiatpavan.it/parcoveicoli.php', function() {
phantom.exit();
});
在命令行:
$ phantomjs resource_logger.js
http://www.fiatpavan.it/parcoveicoli.php
http://www.fiatpavan.it/css/styles.css?v=2.6
http://www.fiatpavan.it/prettyPhoto/prettyPhoto.css
http://code.jquery.com/jquery-1.7.1.min.js
http://www.fiatpavan.it/js/jquery.lazyload.mini.js
http://www.fiatpavan.it/prettyPhoto/jquery.prettyPhoto.js
http://www.fiatpavan.it/js/jquery.local.js?v=2.02
http://www.google-analytics.com/ga.js
http://graphics-server4.gestionaleauto.com/gonline_graphics/4377760_T_53d36d11e0b29.jpg
http://graphics-server4.gestionaleauto.com/gonline_graphics/4572976_T_53d36d53144b2.jpg
http://graphics-server4.gestionaleauto.com/gonline_graphics/4470681_T_53d36d2406fd7.jpg
http://graphics-server4.gestionaleauto.com/gonline_graphics/4062343_T_53d36d48eb4f6.jpg
http://graphics-server4.gestionaleauto.com/gonline_graphics/4281687_T_53d36d34938ac.jpg
http://graphics-server4.gestionaleauto.com/gonline_graphics/4572977_T_53d36d5d4a3b1.jpg
http://graphics-server4.gestionaleauto.com/gonline_graphics/4540811_T_53c4ebe6e5c1b.jpg
http://graphics-server4.gestionaleauto.com/gonline_graphics/4377761_T_5378747d2e1c1.jpg
http://graphics-server4.gestionaleauto.com/gonline_graphics/4188892_T_53d36e6bb31ff.jpg
http://graphics-server4.gestionaleauto.com/gonline_graphics/4221069_T_53d36edd8c721.jpg
http://graphics-server4.gestionaleauto.com/gonline_graphics/4241379_T_53d36f00b8164.jpg
http://graphics-server4.gestionaleauto.com/gonline_graphics/4178839_T_53d36f12c6dea.jpg
http://graphics-server4.gestionaleauto.com/gonline_graphics/4188898_T_53d36f249c437.jpg
http://graphics-server4.gestionaleauto.com/gonline_graphics/4188893_T_53d36eb36b5b1.jpg
http://graphics-server4.gestionaleauto.com/gonline_graphics/4566677_T_53d0c92207ab0.jpg
http://graphics-server4.gestionaleauto.com/gonline_graphics/4175811_T_53d36e858f116.jpg
http://graphics-server4.gestionaleauto.com/gonline_graphics/4574673_T_53d4bda473d1a.jpg
http://graphics-server4.gestionaleauto.com/gonline_graphics/4175793_T_53bbb12f09f65.jpg
http://graphics-server4.gestionaleauto.com/gonline_graphics/4356029_T_53bd02bd1b643.jpg
http://graphics-server4.gestionaleauto.com/gonline_graphics/4356028_T_53bd02d15fb14.jpg
http://www.fiatpavan.it/images/banner_googleplay.png
http://www.fiatpavan.it/images/banner_appstore.png
http://www.fiatpavan.it/images/logo_new_home.png
http://www.fiatpavan.it/images/marchietti/6.png
http://www.fiatpavan.it/images/marchietti/21.png
http://www.fiatpavan.it/images/marchietti/28.png
http://www.fiatpavan.it/images/marchietti/42.png
http://www.fiatpavan.it/images/marchietti/60.png
http://www.fiatpavan.it/images/fe/ico_rss.png
http://connect.facebook.net/it_IT/all.js
http://www.fiatpavan.it/images/pattern_body_home.png?v=1.1
http://www.fiatpavan.it/images/fe/pattern_corpo.gif
http://www.fiatpavan.it/images/fe/ico_menu_sx.gif
http://www.fiatpavan.it/images/fe/bg_campi_form.gif
http://www.fiatpavan.it/images/fe/bg_bottone_scheda.png
http://www.fiatpavan.it/images/box/bg_usato.png
http://www.fiatpavan.it/images/fe/bg_button_dettaglio.png
http://www.fiatpavan.it/images/fe/bg_button_info.png
http://www.fiatpavan.it/images/fe/bg_button_permuta.png
http://www.fiatpavan.it/images/box/bg_km0.png
http://www.fiatpavan.it/images/freccie.png
http://www.fiatpavan.it/images/fe/pattern_footer.gif
http://www.fiatpavan.it/images/fe/arrow-top.png
http://www.google-analytics.com/__utm.gif?utmwv=5.5.5&utms=1&utmn=1200517878&utmhn=www.fiatpavan.it&utmcs=UTF-8&utmsr=1920x1200&utmvp=400x300&utmsc=32-bit&utmul=de-de&utmje=0&utmfl=-&utmdt=Parco%20Veicoli&utmhid=1661598644&utmr=-&utmp=%2Fparcoveicoli.php&utmht=1409579764694&utmac=UA-69527-41&utmcc=__utma%3D92154637.1862396724.1409579765.1409579765.1409579765.1%3B%2B__utmz%3D92154637.1409579765.1.1.utmcsr%3D(direct)%7Cutmccn%3D(direct)%7Cutmcmd%3D(none)%3B&utmu=q~
http://static.ak.facebook.com/connect/xd_arbiter/W2xi4Tmu0YA.js?version=41#channel=f321c29d9c&origin=http%3A%2F%2Fwww.fiatpavan.it
https://s-static.ak.facebook.com/connect/xd_arbiter/W2xi4Tmu0YA.js?version=41#channel=f321c29d9c&origin=http%3A%2F%2Fwww.fiatpavan.it
https://www.facebook.com/connect/ping?client_id=542911519092465&domain=www.fiatpavan.it&origin=1&redirect_uri=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter%2FW2xi4Tmu0YA.js%3Fversion%3D41%23cb%3Df1a3f170ec%26domain%3Dwww.fiatpavan.it%26origin%3Dhttp%253A%252F%252Fwww.fiatpavan.it%252Ff321c29d9c%26relation%3Dparent&response_type=token%2Csigned_request%2Ccode&sdk=joey
http://www.facebook.com/plugins/like_box.php?app_id=542911519092465&channel=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter%2FW2xi4Tmu0YA.js%3Fversion%3D41%23cb%3Df6dfabca%26domain%3Dwww.fiatpavan.it%26origin%3Dhttp%253A%252F%252Fwww.fiatpavan.it%252Ff321c29d9c%26relation%3Dparent.parent&color_scheme=light&header=false&height=187&href=http%3A%2F%2Fwww.facebook.com%2Fpages%2FFiat-Pavan%2F165510546824760&id=fb-iframe&locale=it_IT&sdk=joey&show_border=true&show_faces=true&stream=false&width=292
https://www.facebook.com/plugins/like_box.php?app_id=542911519092465&channel=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter%2FW2xi4Tmu0YA.js%3Fversion%3D41%23cb%3Df6dfabca%26domain%3Dwww.fiatpavan.it%26origin%3Dhttp%253A%252F%252Fwww.fiatpavan.it%252Ff321c29d9c%26relation%3Dparent.parent&color_scheme=light&header=false&height=187&href=http%3A%2F%2Fwww.facebook.com%2Fpages%2FFiat-Pavan%2F165510546824760&id=fb-iframe&locale=it_IT&sdk=joey&show_border=true&show_faces=true&stream=false&width=292
https://fbstatic-a.akamaihd.net/rsrc.php/v2/y4/r/B18dVCfTbA0.js
https://fbcdn-profile-a.akamaihd.net/hprofile-ak-frc3/v/t1.0-1/p50x50/581511_428344043874741_1845523211_n.jpg?oh=28fd20dc57f938fe5b3adbd5ba6d5e31&oe=54605C4A&__gda__=1416507819_4674c67c822c0e6530aa300a2150962e
https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xpa1/v/t1.0-1/c0.14.50.50/p50x50/9573_10151332481280636_362800646_n.jpg?oh=8fb5b25afb2b0f3502e30f980246ce8f&oe=547568F9&__gda__=1416595941_69b7cd122fc5fca24ee98340e9587b0a
https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xpa1/v/t1.0-1/c50.50.621.621/s50x50/1146607_492482014180042_648683217_n.jpg?oh=761e8dce4f06bb14cf34bb289879d200&oe=54701323&__gda__=1415691442_d77df72bec27fce4dd20d770d1595297
https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xpa1/t1.0-1/c0.0.50.50/p50x50/63047_1624062446591_1794195_n.jpg
https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xfa1/v/t1.0-1/c66.66.828.828/s50x50/579240_114958701973059_1273103507_n.jpg?oh=fcf3405fade9194204da46aa9fef0de0&oe=5468D053&__gda__=1415644515_cae14ba72f4550b293b830a76ee7dae5
https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xfp1/v/t1.0-1/c0.0.50.50/p50x50/10395856_888923357800652_73921_n.jpg?oh=0c0133dd897f9d82c6230b1b7ee5b117&oe=54666862&__gda__=1416589126_f130e40019fd03839104e54f2332ee28
https://fbstatic-a.akamaihd.net/rsrc.php/v2/y1/r/LVx-xkvaJ0b.png
對不起,這是什麼都用Ruby或Ruby on Rails的呢?你想讓你的Rails應用程序去尋找特定類型的鏈接的PHP網站? – 2014-09-01 13:57:29
我剛剛添加了Ruby,因爲我將在Ruby中編寫解決方案。但現在它是一個相當普遍的問題,我同意! – Severin 2014-09-01 13:58:50