I made a lo command that is more useful than ls

The era of ls is over

I'm sure many people just type ls when they touch the terminal, but it's a well-known fact that this is just a waste of time, and you should use your time more meaningfully. There is nothing that you can benefit from looking at a list of files you know.

So I made a more useful lo command than ls. As the name implies, it is a more useful command than ls, which gets the latest COMIC LO title and outputs it in a glossy pink color. Can be used instead of ping ()

Place the following python script as lo in a location that is in your PATH.

#! /usr/bin/env python3
from urllib.request import urlopen
import re

with urlopen("http://www.akaneshinsha.co.jp/category/item/itemgenre/itemad/magazine-ad/comic-lo/") as res:
    html = res.read().decode("utf-8")
urlprefix = "http://www.akaneshinsha.co.jp/item/"
founds = re.findall(r'<a href="{}(\d+?)/?".+?>'.format(urlprefix), html)
if not founds:
    quit()

with urlopen(urlprefix + founds[0]) as res:
    html = res.read().decode("utf-8").replace("\n", " ")
founds = re.findall(
    r'<div class="freetxt">\s*<p>.+?</p>\s*<p>(.+?)</p>', html)
if not founds:
    quit()
founds = re.findall(r'「(.+?)」', founds[0])
color = 202
for i, found in enumerate(founds):
    print('\033[38;5;%dm%s\033[0m' % (color, found))
    if (i + 1) % (max(4, len(founds)) // 4) == 0:
        color += 1

Summary

COMIC LO is god

TODO I want to add the -l -a -h option

Recommended Posts

I made a lo command that is more useful than ls
What's new in datetime that is a bit more useful in Python 3
[C language] My locomotive is too slow ~ I made a sl command ~
〇✕ I made a game
I made a VM that runs OpenCV for Python
I made a command to markdown the table clipboard
I made a command to wait for Django to start until the DB is ready
A story that stumbled when I made a chatbot with Transformer
I made a LINE BOT that returns parrots with Go
I made a class that easily performs unixtime ← → datetime conversion
I made a command to generate a table comment in Django
I made a fucking app that won't let you skip
I made a rigid Pomodoro timer that works with CUI
I made a plug-in that can "Daruma-san fell" with Minecraft
I made you to execute a command from a web browser
I made a neural network generator that runs on FPGA
I made a python text
Made a command for FizzBuzz
I made a discord bot
[Python] I made a Line bot that randomly asks English words.
[Python3] I made a decorator that declares undefined functions and methods.
I made a package that can compare morphological analyzers with Python
I made a program that solves the spot the difference in seconds
I made a Twitter bot that mutters Pokemon caught by #PokemonGO
I made a shuffle that can be reset (reverted) with Python
I made a slack bot that notifies me of the temperature
I made a library that adds docstring to a Python stub file.
I made a command to display a colorful calendar in the terminal
Introduction of ls command lsix that can display a list of images
I made a program that automatically calculates the zodiac with tkinter
[python] I made a class that can write a file tree quickly
i! i! ← This is a mathematical formula
I made a C ++ learning site
I made a Line-bot using Python!
I made a CUI-based translation script (2)
I made a wikipedia gacha bot
I made a fortune with Python.
I made a CUI-based translation script
I made a daemon with Python
I made a web application that converts photos into Van Gogh's style
I made a calendar that automatically updates the distribution schedule of Vtuber
[Python] I made a decorator that doesn't seem to have any use.
I made a web application in Python that converts Markdown to HTML
I created a Go library nzargv that arranges command line arguments nicely.
I made a plug-in "EZPrinter" that easily outputs map PDF with QGIS.
I made a Discord bot in Python that translates when it reacts
[Python] I made a utility that can access dict type like a path
I made a Chrome extension that displays a graph on an AMeDAS page
I made a simple timer that can be started from the terminal
I want to identify the alert email. --Is that x a wildcard? ---
I made a library konoha that switches the tokenizer to a nice feeling
I made a tool that makes decompression a little easier with CLI (Python3)
[IOS] I made a widget that displays Qiita trends in Pythonista3. [Python]
I made a module PyNanaco that can charge nanaco credit with python
I made AI patroll the net and created a gadget ranking Web service that is updated once a week