Python Forum
Access my webpage and download files from Python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Access my webpage and download files from Python
#4
Maybe you can help me with this. Using requests and BeautifulSoup I can get this text:

Quote:>>> soup = BeautifulSoup(requests.get(file_url).text)
>>> soup
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<title>Index of /php/uploads</title>
</head>
<body>
<h1>Index of /php/uploads</h1>
<ul><li><a href="/php/"> Parent Directory</a></li>
<li><a href="chineseYearAnimals.txt"> chineseYearAnimals.txt</a></li>
<li><a href="chineseYearAnimals_gapWords.xlsx"> chineseYearAnimals_gapWords.xlsx</a></li>
<li><a href="chineseYearAnimals_gapWords.xlsx.data"> chineseYearAnimals_gapWords.xlsx.data</a></li>
<li><a href="chineseYearAnimals_gapped.txt"> chineseYearAnimals_gapped.txt</a></li>
<li><a href="cloze2.txt"> cloze2.txt</a></li>
<li><a href="cloze3.txt"> cloze3.txt</a></li>
<li><a href="cloze4HiddenRules.txt"> cloze4HiddenRules.txt</a></li>
<li><a href="cloze4HiddenRules.txtnoPrepos"> cloze4HiddenRules.txtnoPrepos</a></li>
<li><a href="cloze4HiddenRules_again.txt"> cloze4HiddenRules_again.txt</a></li>
<li><a href="cloze4HiddenRules_gapped.txt"> cloze4HiddenRules_gapped.txt</a></li>
<li><a href="cloze4HiddenRules_gapped.txt.data"> cloze4HiddenRules_gapped.txt.data</a></li>
</ul>
</body></html>

>>>

So, I just need to get the file names from this and I have what I want.

Can I do this with Regex??
Reply


Messages In This Thread
RE: Access my webpage and download files from Python - by Pedroski55 - May-26-2019, 05:24 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to access text files, hidden behind 'm3u8' resources Pavel_47 4 2,463 Feb-19-2023, 02:47 PM
Last Post: Pavel_47
  Using range slider in flask webpage to use in python KimPet 2 7,849 Jan-23-2021, 11:58 PM
Last Post: snippsat
  How to access a web service from a python script? dangermaus33 6 3,363 Dec-04-2020, 07:04 AM
Last Post: dangermaus33
  Download some JPG files and make it a single PDF & share it rompdeck 5 5,866 Jul-31-2020, 01:15 AM
Last Post: Larz60+
  Python values on a WebPage Petrouil 1 1,977 Apr-01-2020, 05:08 PM
Last Post: ndc85430
  Read Save RadioButtons from Database in Python Flask Webpage Gary8877 0 7,282 Apr-11-2019, 12:33 AM
Last Post: Gary8877
  display multiple sensors on webpage python flask jinja pascale 6 5,395 Jan-29-2019, 10:10 AM
Last Post: pascale
  I wan't to Download all .zip Files From A Website (Project AI) eddywinch82 68 39,559 Oct-28-2018, 02:13 PM
Last Post: eddywinch82
  I Want To Download Many Files Of Same File Extension With Either Wget Or Python, eddywinch82 15 14,976 May-20-2018, 06:05 PM
Last Post: eddywinch82
  Login in a Webpage using a python program sumandas89 2 12,408 Dec-21-2017, 01:43 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020