Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
97 views
in Technique[技术] by (71.8m points)

Python file download with encrypted links

The website has a download button, when i hover over it, it is something like this (this is real url with only the actual website changed.)

https://whatthehell.com/download.php?file=Tzo4OiJzdGRDbGFzcyI6NDp7czoyOiJpcCI7czoxNToiMjIwLjI1NS4xOTguMjE2IjtzOjg6ImZpbGVOYW1lIjtzOjI2OiJ0aGVtZXMvMTM5MDQxX3ZlZW4yMTRuLnppcCI7czo5OiJyZXR1cm5VcmwiO3M6NzU6Imh0dHBzOi8vdmVzdGF0aGVtZXMuY29tL3ZlZW4tdjItMS00LW1pbmltYWwtbGlnaHR3ZWlnaHQtYmxvZy1mb3Itd29yZHByZXNzLyI7czo4OiJzZWN1cml0eSI7czo0MDoiNDhiMTc0NmIzNjEzZTIyYzJhMmFkNDcyMmZiMjE1ZjlhODRmY2RkOCI7fQ==

from python when i read the page, no such link is found, the javascript found on the page has the actual file download url but it doesnt work even if you paste the url in actual browser. the function from view source is like this.

<script type="ac07064234e8f34f59a0999f-text/javascript">
var DownloadFile = "something/something.zip";
var defaultDownloadUrl = "https://whatthehell.com/something/something.zip"; (this url does not work even if paste from browser)
var xhttp = new XMLHttpRequest();
IF STATMENT IS HERE 
xhttp.open("GET", "/generateDownloadUrl.php?returnUrl=" + window.location.href +"&fileName=" + DownloadFile, true);

Can i scrape the encrypted download link or is there any python code to download from the above url? Any help appreciated...

question from:https://stackoverflow.com/questions/65851481/python-file-download-with-encrypted-links

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Seems like Selenium is the way to go. From reading documentation and some videos on yt, I am sure it's going to work. Speed wise will be a factor if I am going to scrape hundreds or thousands of pages.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...