Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8961751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:58:01+00:00 2026-06-15T15:58:01+00:00

Hello i was just wondering i’m trying to create a python application that downloads

  • 0

Hello i was just wondering i’m trying to create a python application that downloads files from the internet but at the moment it only downloads one file with the name i know… is there any way that i can get a list of files in an online directory and downloaded them? ill show you my code for downloading one file at a time, just so you know a bit about what i wan’t to do.

import urllib2

url = "http://cdn.primarygames.com/taxi.swf"

file_name = url.split('/')[-1]
u = urllib2.urlopen(url)
f = open(file_name, 'wb')
meta = u.info()
file_size = int(meta.getheaders("Content-Length")[0])
print "Downloading: %s Bytes: %s" % (file_name, file_size)

file_size_dl = 0
block_sz = 8192
while True:
    buffer = u.read(block_sz)
    if not buffer:
        break

    file_size_dl += len(buffer)
    f.write(buffer)
    status = r"%10d  [%3.2f%%]" % (file_size_dl, file_size_dl * 100. / file_size)
    status = status + chr(8)*(len(status)+1)
    print status,

f.close()

So what is does is it downloads taxi.swf from this website but what i want it to do is to download all .swf’s from that directory “/” to the computer?

Is it possible and thank you so much in advanced. -Terrii-

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:58:02+00:00Added an answer on June 15, 2026 at 3:58 pm

    Since you’re trying to download a bunch of things at once, start by looking for a site index or a webpage that neatly lists everything you want to download. The mobile version of the website is usually lighter than the desktop and is easier to scrape.

    This website has exactly what you’re looking for: All Games.

    Now, it’s really quite simple to do. Just, extract all of the game page links. I use BeautifulSoup and requests to do this:

    import requests
    from bs4 import BeautifulSoup
    
    games_url = 'http://www.primarygames.com/mobile/category/all/'
    
    def get_all_games():
        soup = BeautifulSoup(requests.get(games_url).text)
    
        for a in soup.find('div', {'class': 'catlist'}).find_all('a'):
            yield 'http://www.primarygames.com' + a['href']
    
    def download_game(url):
        # You have to do this stuff. I'm lazy and won't do it.
    
    if __name__ == '__main__':
        for game in get_all_games():
            download_game(url)
    

    The rest is up to you. download_game() downloads a game given the game’s URL, so you have to figure out the location of the <object> tag in the DOM.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello i was just wondering is there anyway to reverse this code so that
Hello fellow Computer People! I could do this myself, but was just wondering if
I know that BR is used to create line-breaks. I'm just wondering if it
Hello I was just writing a little Android application which takes an image from
Hello fellow python users, I bring forth a question that I have been wondering
gcc (GCC) 4.6.3 c89 Hello, I am just wondering if this is the best
Hello I just enabled Legacy mode authorization in Jenkins and it seems that it
hello i have just start using Raphael but i'm very confused in the following
Hello guys. I think it isn't possible just using PHP, but just to be
I was just wondering about the content of question 'Hello, World!' in C without

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.