Skip to content

Instantly share code, notes, and snippets.

View umihico's full-sized avatar

Umihiko Iwasa umihico

View GitHub Profile
@umihico
umihico / get_address_regex.py
Last active July 11, 2018 06:06
大量のテキストから住所を抜き出す
import re
def get_address_regex_lxmltree(lxmltree):
address_list = []
for text in lxmltree.itertext():
address_list.extend(get_address_regex_text(text))
return address_list
@umihico
umihico / requests_threading.py
Last active September 3, 2018 07:46
大量のHTTPリクエストをマルチスレッドで高速に処理する
from umihico_commons.functools import map_multithreading
import requests
def get_threading(urls, *args, **kwargs):
func = _gen_wrapped_requests_func(requests.get)
return _threading(func, urls, *args, **kwargs)
def post_threading(urls, *args, **kwargs):
@umihico
umihico / get_yauc_closed_list.py
Last active July 18, 2018 23:59
ヤフオクの終了済み商品一覧をリスト化する https://youtu.be/GC3pOZTRPR0
def _yauc_strip(string):
deletings = (' ', " ", "\n", "\t", "\xa0")
for deleting in deletings:
string = string.replace(deleting, "")
if string.startswith(":") or string.startswith(":"):
string = string[1:]
return string
@umihico
umihico / debug.log
Last active September 3, 2018 07:46
ヤフオクの終了済み商品の情報を取得 https://youtu.be/GC3pOZTRPR0
[0717/165117.581:ERROR:process_reader_win.cc(123)] NtOpenThread: {アクセス拒否} プロセスはオブジェクトのアクセスを要求しましたが、アクセス権が与えられていません。 (0xc0000022)
[0717/165117.583:ERROR:exception_snapshot_win.cc(88)] thread ID 3656 not found in process
[0717/165225.170:ERROR:process_reader_win.cc(123)] NtOpenThread: {アクセス拒否} プロセスはオブジェクトのアクセスを要求しましたが、アクセス権が与えられていません。 (0xc0000022)
[0717/165225.171:ERROR:exception_snapshot_win.cc(88)] thread ID 5928 not found in process
[0717/165648.489:ERROR:process_reader_win.cc(123)] NtOpenThread: {アクセス拒否} プロセスはオブジェクトのアクセスを要求しましたが、アクセス権が与えられていません。 (0xc0000022)
[0717/165648.493:ERROR:exception_snapshot_win.cc(88)] thread ID 7992 not found in process
@umihico
umihico / get_google_image_search_result.py
Last active September 3, 2018 07:45
google画像検索からタイトル、掲載url、画像urlを含むメタ情報を取得
from umihico_commons.chrome_wrapper import Chrome
from time import sleep
from ast import literal_eval
def get_google_image_search_result(keyword="", url=""):
if keyword:
url = f"https://www.google.co.jp/search?q={keyword}&tbm=isch"
c = Chrome()
c.get(url)
@umihico
umihico / detect_text.py
Last active July 17, 2018 09:33
google画像認識を使って画像から文字起こしする  https://youtu.be/gQ-9aTBlgvA
import ast
import base64
import json
from requests import post
from passpacker import passwords
from pprint import pprint
from io import BytesIO
from umihico_commons.functools import chunks
@umihico
umihico / debug.log
Last active September 3, 2018 07:44
google画像認識apiの出力テキストから画像を再現する https://youtu.be/gQ-9aTBlgvA
[0715/164516.159:ERROR:process_reader_win.cc(123)] NtOpenThread: {アクセス拒否} プロセスはオブジェクトのアクセスを要求しましたが、アクセス権が与えられていません。 (0xc0000022)
[0715/164516.161:ERROR:exception_snapshot_win.cc(88)] thread ID 9360 not found in process
[0715/164839.896:ERROR:process_reader_win.cc(123)] NtOpenThread: {アクセス拒否} プロセスはオブジェクトのアクセスを要求しましたが、アクセス権が与えられていません。 (0xc0000022)
[0715/164839.897:ERROR:exception_snapshot_win.cc(88)] thread ID 12508 not found in process
[0715/164839.914:ERROR:process_reader_win.cc(123)] NtOpenThread: {アクセス拒否} プロセスはオブジェクトのアクセスを要求しましたが、アクセス権が与えられていません。 (0xc0000022)
[0715/164839.915:ERROR:exception_snapshot_win.cc(88)] thread ID 12516 not found in process
[0715/165021.902:ERROR:process_reader_win.cc(123)] NtOpenThread: {アクセス拒否} プロセスはオブジェクトのアクセスを要求しましたが、アクセス権が与えられていません。 (0xc0000022)
[0715/165021.904:ERROR:exception_snapshot_win.cc(88)] thread ID 4632 not found in process
[0715/165021.904:ERROR:process_reader_win.cc(123)] NtOpenThread: {アクセス拒否} プロセスはオブジェクトのアクセスを要求しましたが、アクセス権が与えられていません。 (0xc0000022)
[0715/165021.906:
@umihico
umihico / all_result.txt
Last active September 3, 2018 07:45
野村證券オンラインサービスから四季報を取得 https://youtu.be/ST8ozF5NWO0
This file has been truncated, but you can view the full file.
[OrderedDict([('基礎・財務情報:3,525↑\xa0\xa0(10:45)\xa0+20 (+0.57 %):決算', '3月'),
('基礎・財務情報:3,525↑\xa0\xa0(10:45)\xa0+20 (+0.57 %):設立', '1937.9'),
('基礎・財務情報:3,525↑\xa0\xa0(10:45)\xa0+20 (+0.57 %):上場', '1949.5'),
('基礎・財務情報:3,525↑\xa0\xa0(10:45)\xa0+20 (+0.57 %):特色',
'水産品の貿易、加工、買い付け主力。すしネタに強み。加工食品は業務用が軸。海外加工比率高い'),
('基礎・財務情報:3,525↑\xa0\xa0(10:45)\xa0+20 (+0.57 %):連結事業',
'水産商事52(2)、冷凍食品29(1)、常温食品7(2)、物流サービス0(9)、鰹・鮪11(3)、他0(-4) '
'<18・3>'),
('基礎・財務情報:3,525↑\xa0\xa0(10:45)\xa0+20 (+0.57 %):業種コード', '0050'),
('基礎・財務情報:3,525↑\xa0\xa0(10:45)\xa0+20 (+0.57 %):業種名', '水産・農林業'),
@umihico
umihico / get_amazon_product.py
Last active September 4, 2018 01:03
description
from umihico_commons.requests_wrapper import get
from lxml import html
def _strip_text(text):
text = text.replace("\t", "")
while True:
new_text = text.replace("\n\n", "\n")
if text == new_text:
break
@umihico
umihico / join_videos.bat
Created August 4, 2018 05:29
windowsコマンドプロンプト・ffmpeg経由でmp4,mov動画ファイルを結合
for %%i in (*.mp4 *.mov) do (
ffmpeg -i %%i -c copy -bsf:v h264_mp4toannexb -f mpegts %%i.ts
)
type nul > _list.txt
for %%i in (*.ts) do (echo file %%i) >> _list.txt
ffmpeg -f concat -i _list.txt -c copy concated_temp.ts
ffmpeg -i concated_temp.ts -c copy -bsf:a aac_adtstoasc output.mp4