简体   繁体   中英

How can I scrape a cgi python script from website?

I have just started learning about webscraping using selenium and mechanize with great results. I was wondering if it was at all possible to scrape a cgi python script from a site as well so I can replicate the sites functionality offline.

Here is an example script.

http://www.tutorialspoint.com/cgi-bin/hello.py

When I attempt to scrape this file I get the html output from the script instead of the script itself. Which is this:

<html>
<head>
<title>Hello Word - First CGI Program</title>
</head>
<body>
<h2>Hello Word! This is my first CGI program</h2>
</body>
</html>

The details of the python script can be found here:

http://www.tutorialspoint.com/python/python_cgi_programming.htm

If you can provide any insight I would be extremely grateful.

Thanks

Each site consists of two parts: the back-end and front-end.

"Back-end" means on the server side, usually PHP, Python, ASP or JSP languages.

"Front-end" means client side: HTML, JavaScript and CSS.

You, as a surfer view only the front-end, and this is what you scrape. You have no access to the back end.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM