In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2025-11-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to use python to obtain browser history". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to use python to obtain browser history".
1. Two lines of code to deal with the history of the browser accidentally came across a third-party library, and you can get the browser's history with only two lines of code, once again lamenting the strength of the python community. Install pip install browserhistory using pip
Code example
Import browserhistory as bh
Bh.write_browserhistory_csv ()
The whole source code is only less than 200 lines, but you can easily access the history of Google, Firefox and safari browsers, and support three platforms: mac, linux and windows. Run the program, will generate the corresponding browser history file in the current working directory, the format is csv, including url, title, time. two。 Source code interpretation to maintain a curiosity, is a necessary accomplishment to do technology. How did the author get the history of these three browsers on different platforms? Open the source code and let's find out.
First of all, the author obtains the name of the platform through sys.platform, from which operating system the current program runs.
The browsing history of Google, Firefox and safari is kept in a fixed location under the user directory, so you only need to know the user directory of the currently logged-in user to get the exact location. In the get_database_paths function, the author uses different methods to determine the user directory according to the platform.
The data of these three browsers are stored in sqlite3, and the get_browserhistory function reads the history of the three browsers from the database. This process requires you to close the browser, and the browser and your program cannot operate sqlite3 at the same time.
The final step is to write different browser history to the csv file using the csv module.
Thank you for reading, the above is "how to use python to obtain the browser history" content, after the study of this article, I believe you have a deeper understanding of how to use python to obtain the browser history of this problem, the specific use also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.