Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 27 lines (18 sloc) 673 Bytes
#!/usr/bin/env python
import re
try:
import gtk
primary = gtk.clipboard_get(gtk.gdk.SELECTION_PRIMARY)
if not primary.wait_is_text_available() :
sys.exit(0)
s = primary.wait_for_text()
except:
from PyQt5.QtCore import QApplication
qc = QApplication.clipboard()
s = qc.text(c.Selection)
# Use qc.Clipboard if you want the clipboard selection
# If it's a LinkedIn URL, fix their stupid errors:
if re.search('(www\.)*linkedin.com/', s, flags=re.IGNORECASE):
s = s.replace("&", "&") + "&count=1000&paginationToken="
# eliminate newlines, and any spaces immediately following a newline:
print(re.sub(r'[\r\n]+ *', '', s))