KristinitaLuckyLink
- Description
- Limitations
- Installation
- Activation
- Usage
- Documentation
- Tricks
- Testing environment
- TODO
- Known bugs and another problems
- Troubleshooting
- Contributing
- Thanks
- Terms and conditions
- License
1. Description ¶
1.1. Reason ¶
I insert to my texts links to external sites. Before using KristinitaLuckyLink, that insert link, I need to make these actions:
- move from Sublime Text to browser,
- write search query in search bar,
- press Enter,
- copy link,
- move from browser to Sublime Text,
- insert link.
It may take a lot of time. Use KristinitaLuckyLink I can make all these actions, press one shortcut.
1.2. Demonstration ¶
1.3. Examples ¶
Conversion examples:
kristinitaluckylife
→[kristinitaluckylife](https://www.instagram.com/kristinitaluckylife/)
,Поиск Кристиниты
→[Поиск Кристиниты](https://kristinita.netlify.app/)
.
- You select text,
- KristinitaLuckyLink get query to search engine; query = your selected text,
- KristinitaLuckyLink return first link from search engine SERP,
- Your selected text wrap to Markdown link.
1.4. Saving time ¶
When I wrote this article, I get these links, use KristinitaLuckyLink:
I save minutes of my time.
1.5. Supported search engines ¶
- DuckDuckGo,
- Google.com.
1.6. Supported markups ¶
- Markdown
1.7. Features ¶
- Must work with selection text has any UTF-8 symbols.
2. Limitations ¶
- Use KristinitaLuckyLink you can get alone top link of search engines. I'm sorry, if in top link not that you want.
- I'm not affiliated with Google Search or DuckDuckGo Developers. I am not responsible for the fact that there is one or another result in the top of SERP. You can get unexpected link.
But if in top of SERP one link, but KristinitaLuckyLink out another link, please make these actions.
- If you don’t want by some reasons make actions from installation and activation section, please, don’t install KristinitaLuckyLink.
- From Python Google Search unofficial API:
Overusing KristinitaLuckyLink might lead to your IP being blocked by Google Search servers. Searches through browser might still work but KristinitaLuckyLink will stop working. I recommend keeping a 5 seconds gap after each usage of this library. In most cases, much lower gaps or even continuous use of the library will still work but still this is something to be kept in mind. If you see a 'rate limit' or a 503 error, it's best to stop using the library and try back after some time (~1 minute).
At the time supported:
- Markdown link style,
- English DuckDuckGo and Google search engines.
Personally I use Markdown markup for my articles and Google and DuckDuckGo enough for me. If you use another markups and/or search engines, pull requests welcome.
3. Installation ¶
3.1. Depenedencies ¶
- You need to install Python 3 with pip to your computer, if no.
pip install git+https://github.com/Kristinita/python-duckduckgo
— install DuckDuckGo module, that I ported for Python 3.pip install pygoogling
— install pygoogling module.- Install Sublime Suricate package via Package Control.
3.2. KristinitaLuckyLink ¶
3.2.1. Stable version ¶
Ctrl+Shift+P (⌘⇧p for Mac) → Package Control: Add Repository → paste in opened input field https://github.com/Kristinita/KristinitaLuckyLink
→ Enter → Package Control: Install Package → print KristinitaLuckyLink → Enter.
3.2.2. Development version ¶
As stable version. Solely replace https://github.com/Kristinita/KristinitaLuckyLink
to https://github.com/Kristinita/KristinitaLuckyLink/tree/SashaDevelop
in instruction above.
You will get all changes from SashaDevelop
branch in each Sublime Text start.
4. Activation ¶
4.1. Environment variable ¶
In your operating system add environment variable PYTHONPACKAGES
with value — your Python site-packages
folder, if already no. To find out your path, see “How installation works” item of Python documentation.
Platform | Default value |
---|---|
Unix | /usr/local/lib/pythonX.Y/site-packages |
Windows | C:\PythonXY\Lib\site-packages |
For example, C:\\Python36\\Lib\\site-packages
— path on my Windows.
See examples, how you can add environment variable in your operating system.
If you know, how possible develop a plugin without adding new environment variable, please, answer to this question.
4.2. Commands and hotkeys ¶
Ctrl+Shift+P (⌘⇧p for Mac) → Suricate: Add Profile → select KristinitaLuckyLink → Enter.
4.3. Restart ¶
After all installation and activation actions restart Sublime Text. Operating system restart may be necessary.
KristinitaLuckyLink must successful works.
5. Usage ¶
Select text, for which you want to get link and…
5.1. Shortcuts ¶
… press hotkey. Wait a moment to get the result.
Default hotkeys for platforms:
Platform | DuckDuckGo default shortcut | Google default shortcut |
---|---|---|
Windows and Linux | Ctrl+Shift+Alt+D | Ctrl+Shift+Alt+D |
macOS | ⌘⇧⌥d | ⌘⇧⌥g |
If these hotkeys used in you another packages or you don’t want use default hotkeys by another reasons: Preferences → Browse packages… → User → create a file Default.suricate-profile, if no, and add to them these lines:
{
"user_commands": {
"sasha_kristinitaluckylink_duckduckgo": {
"keys": ["super+keypad_multiply"],
"caption": "KristinitaLuckyLink: DuckDuckGo",
"call": "sublime.kristinita_lucky_link_duck_duck_go"
},
"sasha_kristinitaluckylink_google": {
"keys": ["<c>+super+browser_home"],
"caption": "KristinitaLuckyLink: Google",
"call": "sublime.kristinita_lucky_link_google"
}
}
}
Replace super+keypad8
and <c>+super+browser_home
from example to your preferred keys. See key name convention in Sublime Text 3.
For detailed information about Suricate key bindings see Sublime Suricate documentation.
5.2. Command palette ¶
… use command palette. Wait a moment to … the result.
Captions:
Suricate: KristinitaLuckyLink: DuckDuckGo
,Suricate: KristinitaLuckyLink: Google
.
6. Documentation ¶
- #FuckTheDocs.
7. Tricks ¶
7.1. Clarify ¶
To increase the probability of the expected result сlarify search queries as you clarify, when search in search engines.
For example:
Selected text | KristinitaLuckyLink DuckDuckGo link |
---|---|
Kristina Kiva | www.facebook.com/public/Kristina-Kiva |
Kristina Kiva Marbella | www.instagram.com/kristinitaluckylife/ |
8. Testing environment ¶
- Windows 10 Enterprise LTSB 64-bit EN_
- Python 3.6.4,
- Sublime Text Build 3143,
- pygoogling 0.0.2,
- Python DuckDuckGo for Python 3 0.242.
KristinitaLuckyLink must be works in new versions macOS and Linux.
9. TODO ¶
- unit tests,
- add plugin to Package Control.
10. Known bugs and another problems ¶
10.1. KristinitaLuckyLink ¶
10.2. External ¶
11. Troubleshooting ¶
About all detected bugs please report to issues page. Please, add information about your operation system, Sublime Text 3 and KristinitaLuckyLink versions.
11.1. Incorrect links ¶
If use KristinitaLuckyLink you get not top link of Google or DuckDuckGo SERP, please, make actions below.
11.1.1. SublimeREPL ¶
- Install SublimeREPL via Package Control.
- Ctrl+Shift+P (⌘⇧p for Mac) → SublimeREPL: Python. Paste to opened tab code below.
11.1.2. DuckDuckGo ¶
Replace Кристина Кива
to your real selection text.
>>> from duckduckgo import query
>>> dlink = query('! Кристина Кива').redirect.url
>>> dlink
Press Enter.
If link, that you get via KristinitaLuckyLink, and this link match; it DuckDuckGo module problem.
11.1.3. Google ¶
Replace Кристина Кива
to your real selection text.
>>> from pygoogling.googling import GoogleSearch
>>> google_search = GoogleSearch('Кристина Кива')
>>> google_search.start_search(max_page=1)
>>> glink = google_search.search_result[0]
>>> glink
Press Enter.
If link, that you get via KristinitaLuckyLink, and this link match; it pygoogling module problem.
12. Contributing ¶
Pull requests welcome! But, please, adhere to the following rules.
- Please, not add inside this package external modules. My code “philosophy” is that all modules must installed separately.
- Code must match PEP8 rules. Max line length — 120 symbols.
13. Thanks ¶
14. Terms and conditions ¶
By using this package, you agree that the KristinitaLuckyLink, Sublime Text, Python DuckDuckGo and pygoogling authors won't be responsible for any damage that comes to you and/or your property. You hereby agree to take all responsibilities for using this package. The author is merely a developer who created this package but you are the one who is using it.
15. License ¶
- MIT.