0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Webスクレイピング&ファイル名一覧獲得

Last updated at Posted at 2020-09-19

#Webスクレイピング
Beautiful Soupについて:https://gammasoft.jp/blog/difference-find-and-select-in-beautiful-soup-of-python/

##code

#4travelの場合
import requests
from bs4 import BeautifulSoup

url = 'https://4travel.jp/dm_shisetsu/10002779#contents_top'
r = requests.get(url)
soup = BeautifulSoup(r.text, "html.parser")
reviews = soup.select('[class="shisetsu_reviewItem"]')
print(reviews)

##例

[<li class="shisetsu_reviewItem">
<div class="review_summaryBox is_reviewCaption">
<div class="u_titleWrap">
<h3 class="u_titleItem">
...

#ファイル名一覧獲得
https://note.nkmk.me/python-listdir-isfile-isdir/

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?