Skip to content

Instantly share code, notes, and snippets.

@tuna2134
Last active August 4, 2022 01:18
Show Gist options
  • Save tuna2134/6653af86eadff7d3fc67db4b4864ce9d to your computer and use it in GitHub Desktop.
Save tuna2134/6653af86eadff7d3fc67db4b4864ce9d to your computer and use it in GitHub Desktop.
Linestampを抽出するためのコードです。
import requests
from bs4 import BeautifulSoup
r = requests.get("https://store.line.me/stickershop/product/13584756/ja")
soup = BeautifulSoup(r.content, "html.parser")
urls = []
for span in soup.find_all("span", class_="mdCMN09Image"):
if not span.get("style")[21:-2] in urls:
urls.append(span.get("style")[21:-2])
with open("urls.txt", "w") as f:
f.write("\n".join(url for url in urls))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment