#π How to differentiate a http-request?
30 messages Β· Page 1 of 1 (latest)
@lusty raptor
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Are you sure it gives 200? Such pages almost always return 404, even though user is given nice html - because any error page can still be renderable html
Yes, it returns 200 indeed
Please show code and url to test
URL: https://tweedback.de/thisisjustatest
Code:
def checks_url(url):
response = requests.head(url, allow_redirects=True)
print(response.status_code)
if response.status_code == 200:
print(f"Domain exists: {url}")
else:
print(f"Domain does not exist: {url}")
if __name__ == "__main__":
url = "https://tweedback.de/thisisjustatest"
checks_url(url)
Robots.txt of that website doesn't allow any automated scraping for anyone, so they probably don't care for handling errors correctly
How to find that Robots.txt file? π€
Anyways, because their robots.txt doesn't allow automatic access for anyone (user-agent: *) to anything other than index.html and assets, I don't think we can help you
Uh, robots.txt file is by standard directly in the root
What does user-agent: * even mean? π
* Means anything and everything.
robots.txt is the filename used for implementing the Robots Exclusion Protocol, a standard used by websites to indicate to visiting web crawlers and other web robots which portions of the website they are allowed to visit.
The standard, developed in 1994, relies on voluntary compliance. Malicious bots can use the file as a directory of which pag...
And what does Disallow: /secret/ mean?
Open the whole wiki page, not just the image
But is it technically possible to search for these sites /secret/? π€
@lusty raptor Looking at your past chat-history it looks like you are just trying this on different websites that have it against scraping/crawling in their TOS/robots.txt.
If you want help concerning this project of yours please find a suitable website that is designed and explicitly allows for scraping/crawling. This allows us to help you as what you would be doing wont be against our servers TOS.
I definitely see the underlying concerns about this case. However, it is not in my intention to breach the ToS. I'm just asking from an educational perspective, whether this is possible or not. What do encounter as a website owner and so on?
Its good thats its not your intention to break a websites TOS. However Breaking a sites TOS if you meant it or not is besides the point.
Here are some sites i found that may be of use to you. These are made to be scraped.
https://books.toscrape.com/
https://quotes.toscrape.com/
https://crawler-test.com/
https://the-internet.herokuapp.com/
https://realpython.github.io/fake-jobs/
https://webscraper.io/test-sites
Thanks, but is it technically possible to scrape these websites? I'm curious, you know? π€
Yes its possible? That's what they were made to do... To be scraped
No, I talk about the sites, which are not made to be scraped. Is it possible to handle it differently, so that you can scrape them? Again: due to curiosity
Every-site can be scarped in the same way. The difference between the sites i listed and the ones you have tried is their TOS (If they want to be scraped).
Is the robots.txt supposed to be read by humans or bots? Is it a information for humans or a system that prevents bots, spiders to crawl on their pages
sites that don't want for you to scrape them will actively block you from scraping them, with a series of measures from obfuscation to captchas to banning your IP address
We will not assist you to scrape such sites
Both
it serves both as a reference for humans thinking about scraping it, but most importantly is well supported by many web crawlers
@lusty raptor Please read this wiki page in its entirety.
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.