Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE REQ]fetch history and bookmarks from default browser #96

Closed
ObaraEmmanuel opened this issue Nov 8, 2020 · 6 comments · Fixed by #123
Closed

[FEATURE REQ]fetch history and bookmarks from default browser #96

ObaraEmmanuel opened this issue Nov 8, 2020 · 6 comments · Fixed by #123
Labels
enhancement New feature or request

Comments

@ObaraEmmanuel
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Currently, it is possible to specify a specific browser or even all browsers but it would be interesting if you can specify that history and/or bookmarks be fetched from the default browser in use. This would most probably provide the most credible and recent history. I understand fetching from all browsers would work too but fetching from the default browser will provide the most recent and credible history all while having to only read from one browser.

Describe the solution you'd like
We could start by allowing default as a value to the -b argument. As for the implementation I am open to ideas.

@ObaraEmmanuel ObaraEmmanuel added the enhancement New feature or request label Nov 8, 2020
@Samyak2
Copy link
Member

Samyak2 commented Nov 8, 2020

Good idea!
The webbrowser module can help with this (wow python has too many inbuilt modules xD).

import webbrowser
c = webbrowser.get()
print(c.name) # or print(c.basename)

The above code gave firefox which is my default browser. It needs to be tested for other browsers too.

@ObaraEmmanuel
Copy link
Contributor Author

ObaraEmmanuel commented Nov 8, 2020

In windows c is a webbrowser.WindowsDefault object and the name and basename attribute are empty strings 😅!

@Samyak2
Copy link
Member

Samyak2 commented Nov 8, 2020

For windows, I found these SOF questions:

Question 1

Question 2

Though I haven't tested these.

@ObaraEmmanuel
Copy link
Contributor Author

>>> from winreg import HKEY_CURRENT_USER, OpenKey, QueryValueEx
>>> reg_path = r'Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice'
>>> with OpenKey(HKEY_CURRENT_USER, reg_path) as key:
...     print(QueryValueEx(key, 'ProgId'))
...
('ChromeHTML', 1)

The solution in Question 2 sorta works as you can see above. ChromeHTML is a weird name and would need us to preprocess. I was able to map out as many of the browsers on windows as I could:

Browser Registry value
Chrome ChromeHTML
Edge MSEdgeHTM
Firefox FirefoxURL-308046B0AF4A39CB
Opera OperaStable
Internet Explorer IE.HTTPS
Edge (Legacy) AppX90nv6nhay5n6a98fnetv7tpk64pp35es

As you can see, It's a jungle inside the registry. It is still possible to write a function that parses these names nonetheless.

@Samyak2
Copy link
Member

Samyak2 commented Nov 10, 2020

Thank you for mapping out those values.

It indeed looks like a jungle haha, this feature will need quite a bit of manual work and some tricks.

Do you want to take up this issue? xD

@ObaraEmmanuel
Copy link
Contributor Author

No problem, I will begin researching and working on it. We'll need a lot of collaborative effort to ensure it works on as many platforms as possible though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants