KristinitaLuckyLink

Page loading, please, little wait
Version 0.1.0
Posted —
Last modified —

Header image

  1. Description
    1. Reason
    2. Demonstration
    3. Examples
    4. Saving time
    5. Supported search engines
    6. Supported markups
    7. Features
  2. Limitations
  3. Installation
    1. Depenedencies
    2. KristinitaLuckyLink
      1. Stable version
      2. Development version
  4. Activation
    1. Environment variable
    2. Commands and hotkeys
    3. Restart
  5. Usage
    1. Shortcuts
    2. Command palette
  6. Documentation
  7. Tricks
    1. Clarify
  8. Testing environment
  9. TODO
  10. Known bugs and another problems
    1. KristinitaLuckyLink
    2. External
  11. Troubleshooting
    1. Incorrect links
      1. SublimeREPL
      2. DuckDuckGo
      3. Google
  12. Contributing
  13. Thanks
  14. Terms and conditions
  15. 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:

  1. move from Sublime Text to browser,
  2. write search query in search bar,
  3. press Enter,
  4. copy link,
  5. move from browser to Sublime Text,
  6. 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.ru/).
  1. You select text,
  2. KristinitaLuckyLink get query to search engine; query = your selected text,
  3. KristinitaLuckyLink return first link from search engine SERP,
  4. Your selected text wrap to Markdown link.

KristinitaLuckyLink example

1.4. Saving time

When I wrote this article, I get these links, use KristinitaLuckyLink:

  1. kristinitaluckylife,
  2. pygoogling,
  3. Sublime Suricate,
  4. SublimeREPL,
  5. PEP8,
  6. Lintly,
  7. keith-hall,
  8. facelessuser.

I save minutes of my time.

1.5. Supported search engines

  1. DuckDuckGo,
  2. Google.com.

1.6. Supported markups

  1. Markdown

1.7. Features

  1. Must work with selection text has any UTF-8 symbols.

2. Limitations

  1. Use KristinitaLuckyLink you can get alone top link of search engines. I'm sorry, if in top link not that you want.

  2. 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.

  3. If you don't want by some reasons make actions from installation and activation section, please, don't install KristinitaLuckyLink.

  4. Copy from here:

    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).

  5. At the time supported:

    1. Markdown link style,
    2. 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

  1. You need to install Python 3 with pip to your computer, if no.
  2. pip install git+https://github.com/Kristinita/python-duckduckgo — install DuckDuckGo module, that I ported for Python 3.
  3. pip install pygoogling — install pygoogling module.
  4. 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/KristinitaLuckyLinkEnterPackage Control: Install Package → print KristinitaLuckyLinkEnter.

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.

PlatformDefault value
Unix/usr/local/lib/pythonX.Y/site-packages
WindowsC:\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 KristinitaLuckyLinkEnter.

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:

PlatformDuckDuckGo default shortcutGoogle default shortcut
Windows and LinuxCtrl+Shift+Alt+DCtrl+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: PreferencesBrowse 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.

Command palette

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 textKristinitaLuckyLink DuckDuckGo link
Kristina Kivawww.facebook.com/public/Kristina-Kiva
Kristina Kiva Marbellawww.instagram.com/kristinitaluckylife/

8. Testing environment

  1. Windows 10 Enterprise LTSB 64-bit EN_
  2. Python 3.6.4,
  3. Sublime Text Build 3143,
  4. pygoogling 0.0.2,
  5. Python DuckDuckGo for Python 3 0.242.

KristinitaLuckyLink must be works in new versions macOS and Linux.

9. TODO

  1. unit tests,
  2. 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

  1. Install SublimeREPL via Package Control.
  2. 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.

  1. Please, not add inside this package external modules. My code “philosophy” is that all modules must installed separately.
  2. Code must match PEP8 rules. Max line length — 120 symbols. Desirable, 100% for Lintly.

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