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 7867489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:43:42+00:00 2026-06-03T00:43:42+00:00

How can I make this script grab the nmv-fas from the link name and

  • 0

How can I make this script grab the “nmv-fas” from the link name and create a directory with that name then place all the files that are downloaded in that directory.

all.html:

<a href="http://www.youversion.com/bible/gen.45.nmv-fas">http://www.youversion.com/bible/gen.45.nmv-fas</a>
<a href="http://www.youversion.com/bible/gen.46.nmv-fas">http://www.youversion.com/bible/gen.46.nmv-fas</a>
<a href="http://www.youversion.com/bible/gen.47.nmv-fas">http://www.youversion.com/bible/gen.47.nmv-fas</a>
<a href="http://www.youversion.com/bible/gen.48.nmv-fas">http://www.youversion.com/bible/gen.48.nmv-fas</a>
<a href="http://www.youversion.com/bible/gen.49.nmv-fas">http://www.youversion.com/bible/gen.49.nmv-fas</a>
<a href="http://www.youversion.com/bible/gen.50.nmv-fas">http://www.youversion.com/bible/gen.50.nmv-fas</a>
<a href="http://www.youversion.com/bible/exod.1.nmv-fas">http://www.youversion.com/bible/exod.1.nmv-fas</a>
<a href="http://www.youversion.com/bible/exod.2.nmv-fas">http://www.youversion.com/bible/exod.2.nmv-fas</a>
<a href="http://www.youversion.com/bible/exod.3.nmv-fas">http://www.youversion.com/bible/exod.3.nmv-fas</a>    

files saved in folder named:

nmv-fas

python:

import lxml.html as html
import urllib
import urlparse
from BeautifulSoup import BeautifulSoup
import re

root = html.parse(open('all.html'))
for link in root.findall('//a'):
  url = link.get('href')
  name = urlparse.urlparse(url).path.split('/')[-1]
  f = urllib.urlopen(url)
  s = f.read()
  f.close()
  soup = BeautifulSoup(s)
  articleTag = soup.html.body.article
  converted = str(articleTag)
  open(name, 'w').write(converted)
  • 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-03T00:43:43+00:00Added an answer on June 3, 2026 at 12:43 am

    You could use the lxml module to parse links out of the file, and then use urllib to download each link. Reading the links might look like this:

    import lxml.html as html
    
    root = html.parse(open('links.html'))
    for link in root.findall('//a'):
      url = link.get('href')
    

    You can download a link to a file using urllib.urlopen:

    import urllib
    import urlparse
    
    # extract the final path component and use it as
    # the local filename.
    name = urlparse.urlparse(url).path.split('/')[-1]
    
    fd = urllib.urlopen(url)
    open(name, 'w').write(fd.read())
    

    Put these together and you should have something similar to what you want.

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

Sidebar

Related Questions

how can I make this jquery script close all previously opened children when entering
Can anyone please tell me how do I make this script run in IE
How i can make this condition en VB.NET If e.KeyCode = [a-zA-Z0-9] Then 'Blah
How can I make this code work? class Meta @array = [:a,:b] def self.method_missing(name,
How can I make this link use the child selector without changing or removing
how can I make this work? $current_id=5; SELECT Id FROM table1 WHERE Output='yes' and
i was wondering if anyone can tell me how to make this script work.
How can I make this input transparent? <input type=text class=foo> I've tried this but
How can I make this sliding panel example to slide down on mouseover and
As you know the dash introduces a comment how can I make this valid?

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.