# 其它公開網站爬蟲(PTT, Yahoo電影戲劇)
## 爬取實時超過1000名用戶上線的PTT討論版
### 程式碼
```python=
# 實時超過1000名用戶上線的PTT用戶版
import requests
from bs4 import BeautifulSoup
url = 'https://www.ptt.cc/bbs/hotboards.html'
re = requests.get(url)
soup_ptt = BeautifulSoup(re.text, 'html.parser')
all_boards = soup_ptt.findAll('div', {'class':'b-ent'})
for board in all_boards:
name = board.find('div', {'class':'board-name'}).text
user_count = board.find('div', {'class':'board-nuser'}).text
if int(user_count) >= 1000:
print(name, user_count)
```
### 結果
**(2023/03/28 18:56)**
| 討論版 | 上線用戶數 |
| -------- | -------- |
|Gossiping | 11871 |
|C_Chat | 4254 |
|Baseball | 3083 |
|Stock | 2821 |
|NBA | 1972 |
|Lifeismoney | 1098 |
|HatePolitics | 1080 |
## 爬取Yahoo電影戲劇上討論度較高的影視作品名稱與主要演員
### 程式碼
```python=
# Yahoo電影戲劇
import requests
from bs4 import BeautifulSoup
url = 'https://movies.yahoo.com.tw'
re = requests.get(url)
soup_yahoo = BeautifulSoup(re.text, 'html.parser')
for movie in soup_yahoo.findAll('div', {'class':'movielist_info'}):
print(movie.a.text)
url_movie = movie.a['href']
re_movie = requests.get(url_movie)
soup_movie = BeautifulSoup(re_movie.text, 'html.parser')
for name in soup_movie.findAll('div', {'class':'actor_info'}):
name = name.text.replace(' ','').replace('\n',' ')
print(name)
```
### 結果
**(2023/03/28 18:48)**
| 作品名稱 | 主要演員 |
| -------- | -------- |
| 龍與地下城:盜賊榮耀 | 蜜雪兒羅莉葛茲 MichelleRodriguez<br>克里斯潘恩 ChrisPine<br>雷傑尚佩吉 Regé-JeanPage<br>休葛蘭 HughGrant
|白日青春 | 黃秋生 AnthonyWong<br>太保 Tai-Bo|
|65:恐怖行星 | 亞當崔佛 AdamDriver |
|做工的人 電影版 | 李銘順 ChristopherLee<br>游安順<br>薛仕凌<br>苗可麗<br>曾珮瑜 PeggyTseng<br>曾敬驊|
|電影版殘念生物事典<br>《孩子,你好嗎?》小黃花一葉系列電影<br>鏡之孤城 | 北村匠海 KitamuraTakumi<br>吉柳咲良 SakuraKiry<br>麻生久美子 KumikoAso<br>宮崎葵 AoiMiyazaki|