這個答案可能有點模糊 - 這是因爲問題不是非常具體。
如果我理解得很好,您想查看訪問頁面的歷史。問題在於它不直接與HTML,HTTP協議或Web服務相關。歷史記錄(您可以在Firefox中按Ctrl-H時觀察到)是在Firefox中實現的工具,因此它絕對取決於實施。可能沒有標準庫能夠提取信息。
至於HTTP協議和HTML中頁面的內容,沒有什麼像交互與頁面的內容。該協議使用帶有URL的GET作爲參數,Web服務器將文本正文與一些元信息一起發回。調用者(瀏覽器)可以對返回的數據執行任何操作。瀏覽器使用標記的文本,並將其解釋爲可讀文檔,並儘可能好地呈現零件。交互(點擊href)由瀏覽器實現。它會導致http協議的其他GET命令。
要回答你的問題,你需要找到Mozilla Firefox 23如何存儲歷史記錄。很可能你可以在內部SQLite數據庫的某處找到它。
更新2015-08-24:請參閱erasmortg關於在Firefox中放置信息的更改的評論。 (下面的文本比這個舊。)
更新:打開的選項卡列表綁定到用戶。正如你可能需要它的Windows,你應該首先得到像c:\Users\myname.mydomain\AppData\Roaming\Mozilla\Firefox\Profiles\yoodw5zk.default-1375107931124\sessionstore.js
這樣的路徑。配置文件名稱可能應該從c:\Users\myname.mydomain\AppData\Roaming\Mozilla\Firefox\profiles.ini
中提取。我剛剛複製了sessionstore.js
試圖獲取數據。正如它說javascript,我確實使用標準的json
模塊來解析它。你基本上得到字典。其中一個項目'windows'
包含另一個字典,其'tabs'
又包含有關選項卡的信息。
複製你sessionstore.js
到工作目錄,並有執行以下腳本:既顯示在控制檯(幾行)上
#!python3
import json
with open('sessionstore.js', encoding='utf-8') as f:
content = json.load(f)
# The loaded content is a dictionary. List the keys first (console).
for k in content:
print(k)
# Now list the content bound to the keys. As the console may not be capable
# to display all characters, write it to the file.
with open('out.txt', 'w', encoding='utf-8') as f:
# Write the overview of the content.
for k, v in content.items():
# Write the key and the type of the value.
f.write('\n\n{}: {}\n'.format(k, type(v)))
# The value could be of a list type, or just one item.
if isinstance(v, list):
for e in v:
f.write('\t{}\n'.format(e))
else:
f.write('\t{}\n'.format(v))
# Write the content of the tabs in each windows.
f.write('\n\n=======================================================\n\n')
windows = content['windows']
for n, w in enumerate(windows, 1): # the enumerate is used just for numbering the windows
f.write('\n\tWindow {}:\n'.format(n))
tabs = w['tabs']
for tab in tabs:
# The tab is a dictionary. Display only 'title' and 'url' from
# 'entries' subdictionary.
e = tab['entries'][0]
f.write('\t\t{}\n\t\t{}\n\n'.format(e['url'], e['title']))
結果,並寫入out.txt
文件在工作目錄。該out.txt
(在文件的結尾)包含類似的東西在我的情況:
Window 1:
http://www.cyrilmottier.com/
Cyril Mottier
http://developer.android.com/guide/components/fragments.html#CommunicatingWithActivity
Fragments | Android Developers
http://developer.android.com/guide/components/index.html
App Components | Android Developers
http://www.youtube.com/watch?v=ONaD1mB8r-A
▶ Introducing RoboSpice: A Robust Asynchronous Networking Library for Android - YouTube
http://www.youtube.com/watch?v=5a91dBLX8Qc
Rocking the Gradle with Hans Dockter - YouTube
http://stackoverflow.com/questions/18439564/how-to-keep-track-of-webpages-opened-in-web-browser-using-python
How to keep track of webpages opened in web-browser using Python? - Stack Overflow
https://www.google.cz/search?q=Mozilla+firefox+list+of+open+tabs&ie=utf-8&oe=utf-8&rls=org.mozilla:cs:official&client=firefox-a&gws_rd=cr
Mozilla firefox list of open tabs - Hledat Googlem
https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/tutorials/list-open-tabs.html
List Open Tabs - Add-on SDK Documentation
https://support.mozilla.org/cs/questions/926077
list all tabs button not showing | Fórum podpory Firefoxu | Podpora Mozilly
https://support.mozilla.org/cs/kb/scroll-through-your-tabs-quickly
Scroll through your tabs quickly | Nápověda k Firefox
建設性批評:發表評論解釋downvote永遠不會傷害。它可以幫助避免將來出現不好的問題。 –
**這是任何人投票結束太寬**。我專門寫了「我想使用**標準Python庫**從我的瀏覽器獲取數據。」我將它標記爲Python3,而Python有一個哲學理念:**應該有一種方法來做事**,而Python3在Python2中處理了許多冗餘。那麼它如何過於寬泛?請解釋。我想聽聽解釋。 –