0
我有一個URL的列表,並希望爲其每個網頁刮取位置對象。我所指的數據是通過在瀏覽器的控制檯中鍵入「window.location」生成的。例如,Chrome會www.github.com執行此操作會給你類似以下的輸出:如何刮取位置對象?
位置{分配:功能,取代:函數重載:函數,ancestorOrigins:DOMStringList,來源:「 https://github.com「...}
展開時,你可以看到更多信息:
Location { ancestorOrigins: DOMStringList assign: function() { [native code] } hash: "" host: "github.com" hostname: "github.com" href: "https://github.com/" origin: "https://github.com" pathname: "/" port: "" protocol: "https:" reload: function() { [native code] } replace: function() { [native code] } search: "" toString: function toString() { [native code] } valueOf: function valueOf() { [native code] } __proto__: Location }
我已經使用過Python和Mechanize庫來刮過去,但是直到現在從未想過這個功能,我不知道如何繼續。任何建議都會受到歡迎。
原來,這是非常可行的使用PhantomJS庫。我一直在玩幾分鐘,並獲得我需要的功能。 –