Skip to content

Instantly share code, notes, and snippets.

import requests
from bs4 import BeautifulSoup
import notification as nt
# スクレイピング対象のURL
url = "XXXX/CCC"
# Press先のURL
url2 = "XXXX"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@obafgkm44
obafgkm44 / roots_getter.py
Created April 3, 2019 18:43
スクレイピングーー語源で英単語を増やす
import requests
from bs4 import BeautifulSoup as bs4
#<td>のタグを抽出する
r = requests.get('http://gogengo.me/roots')
data = bs4(r.text,'html.parser')
elems = data.findAll("td")
#テキストを画面に出力する
for e in elems:
@obafgkm44
obafgkm44 / img_resize.py
Last active March 31, 2019 17:12
画像を切り取る
# ダウンロードした画像を画面に表示する
import matplotlib.pyplot as plt
import cv2
# 画像を読み込む
img = cv2.imread("sakura.jpg")
#一部を切り取り
im = img[100:300,100:300]
@obafgkm44
obafgkm44 / img_getter.py
Last active March 31, 2019 17:10
画像のダウンロードとその画像を画面に表示させる
# 画像のダウンロード
import urllib.request as req
url = "https://amd.c.yimg.jp/amd/20190331-00000059-asahi-000-2-view.jpg"
req.urlretrieve(url,"sakura.jpg")
# ダウンロードした画像を画面に表示する
import matplotlib.pyplot as plt
import cv2
# 画像を読み込む
img = cv2.imread("sakura.jpg")