[PYTHON] A script that sends a lot of websites to people who regularly visit them every day

Introduction

I check about 30 websites every day, so I wrote a script to operate them from the terminal.

Easy way

People who always see only about 10 pages on the same page

  1. Bookmark to a folder
  1. Select Open All Bookmarks
  2. All links open at the same time
スクリーンショット 2017-04-15 15.03.32.png

This script

specification

code


# coding: utf-8

import webbrowser

LINES_NUM = 2

urls = """
https://www.google.co.jp/
https://github.com/

qiita.com
"""

urls = [url for url in urls.split("\n") if url]

for i, url in enumerate(urls, 1):

    # correct url
    if not url.startswith("http"):
        url = "http://" + url

    webbrowser.open_new_tab(url)

    # stop each line by standard input
    if i % LINES_NUM == 0:
        raw_input("type something >> ")

Thank you for fixing it in the comment section. M (_) m

スクリーンショット 2017-04-15 15.09.05.png

[Type something >>] will be displayed like this, so if you press Enter appropriately, the next specified line (LINES_NUM = 2) will be read.

reference

Delete blank line: [Delete empty element from list](http://haru.moo.jp/2015/07/%E3%83%AA%E3%82%B9%E3%83%88%E3% 81% 8B% E3% 82% 89% E7% A9% BA% E3% 81% AE% E8% A6% 81% E7% B4% A0% E3% 82% 92% E5% 89% 8A% E9% 99% A4% E3% 81% 99% E3% 82% 8B /)

Recommended Posts

A script that sends a lot of websites to people who regularly visit them every day
How to put a lot of pipelines together and put them away at once
I made a LINE Bot that sends recommended images every day on time
A magic word (?) That may save people who are addicted to building using the Intel compiler of Python + Numpy.
A script that can perform stress tests according to the number of CPU cores