Ask coding questions

← Back to all posts
Web Scraping in Python
JBloves27 (1720)

Hello coders,

I'm trying to make a python portfolio, that can be used in your description or whatever. However, I'm trying to web scrape, a new thing I wanted to try. But again, I'm failing. I'm getting the info/web scrape from replit, and ive searched online for other info, but I keep getting errors. If any of you guys could help me, it would be GREATLY appreciated. I realllly need this badly. So thanks. If you can help me. lol. BAI!

Answered by Coder100 (17026) [earned 5 cycles]
View Answer
Comments
hotnewtop
Coder100 (17026)

gotta add this thing in the headers:

'User-Agent': 'Mozilla/2.0'

done!

JBloves27 (1720)

where should I put it in? @Coder100

Coder100 (17026)
requests.get(f"https://replit.com/{username}", headers = {
  'User-Agent': 'Mozilla/2.0'
})

@JBloves27 smh

JBloves27 (1720)

oh. lol, first time trying this btw @Coder100

Coder100 (17026)

lmao
well have fun scraping @JBloves27

Coder100 (17026)

and if you ask how to execute js ur getting blocked @JBloves27

JBloves27 (1720)

lol. uh, idk wat u mean. but ok. and ill have to study more, bc it doesnt work well... try running it? @Coder100

Coder100 (17026)

@JBloves27

YO THAT'S A RESULT
go parse it mr.

JBloves27 (1720)

hmmm. ok then? ill just mark @Coder100

JBloves27 (1720)

uh, well im trying to parse now, working on it @Coder100

Coder100 (17026)

yeah
replit doesn't like it when you try to scrape their sites