forked from buckyroberts/Source-Code-from-Tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path26_python.py
More file actions
19 lines (16 loc) · 511 Bytes
/
Copy path26_python.py
File metadata and controls
19 lines (16 loc) · 511 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import requests
from b4 import BeautifulSoup
def trade_spider(max_pages):
page = 1
while page <= max_page:
url = 'https://buckysroom.org/trade/search.php?page=' + str(page)
source_code = requests.get(url)
plain_text = source_code.text
soup = BeautifulSoup(plain_text)
for link in soup.findAll('a', {'class': 'item-name'}):
href = "https://buckysroom.org" + link.get('href')
title = link.string
print(href)
print(title)
page += 1
trade_spider(1)