GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Source-Code-from-Tutorials/Python/26_workingsolution_python.py at master · prabz/Source-Code-from-Tutorials

Expand file tree

/

26_workingsolution_python.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
42 lines (29 loc) · 1.33 KB
/

26_workingsolution_python.py

Copy path

File metadata and controls

42 lines (29 loc) · 1.33 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# [ Edited On 16.2.2016 ]
# On that date this program was working.
#Warning: For original Bucky's typed lines of code, take a look at the file 26_python.py .
#Description:
#This file is alternative solution for web crowler.
# Mayor reason for this is that website BuckysRoom.com is down, so original code doesnot work anymore.
#
# Solution description (what this actually program does - not the same as in the video):
#This program goes on website https://www.thenewboston.com/search.php?type=0&sort=reputation ,
#and goes on every user's profile, and on that profile,
#it prints the first few (approx. 20) links of latest photos. To view photos, click on url or copy in web broser.
# But history is changing and sooner or later this file or program will not work!.
# On day of the creation this program was working.
import requests
from bs4 import BeautifulSoup
def trade_spider(max_pages):
page = 1
while page <= max_pages:
url = 'https://thenewboston.com/search.php?type=0&sort=reputation&page==' + str(page)
source_code = requests.get(url, allow_redirects=False)
plain_text = source_code.text.encode('ascii', 'replace')
soup = BeautifulSoup(plain_text,'html.parser')
for link in soup.findAll('a', {'class': 'user-name'}):
href = link.get('href')
title = link.string
print(href)
print(title)
page += 1
trade_spider(1)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.