Last active
October 26, 2015 06:11
-
-
Save autosquid/423b5d03bfc70f56d04d to your computer and use it in GitHub Desktop.
python script for batch opening urls and searching with keywords
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def slowopen(fname): | |
| with open(fname, 'r') as f: | |
| for url in f: | |
| # url = slowopen_ieee(url) | |
| if platform.system() == 'Darwin': | |
| os.system(" ".join(["open -a Safari", url])) | |
| #os.system(" ".join(["open", url])) | |
| else: | |
| os.system(" ".join(["start", url])) | |
| time.sleep(5) | |
| def sortfile(srcfile, dstfile): | |
| urls = [] | |
| with open(srcfile, 'r') as f: | |
| for url in f: | |
| urls.append(url) | |
| sortedurls = sorted(urls) | |
| with open(dstfile, 'w') as f: | |
| f.write('\n'.join(sortedurls)) | |
| def slowsearch(fname): | |
| with open(fname, 'r') as f: | |
| for item in f: | |
| # item = slowopen_ieee(item) | |
| item = 'http://search.aol.com/aol/search?q=' + '+'.join(item.split(' ')) | |
| if platform.system() == 'Darwin': | |
| #os.system(" ".join(["open -a Safari", item])) | |
| os.system(" ".join(["open", item])) | |
| else: | |
| os.system(" ".join(["start", item])) | |
| time.sleep(5) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment