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

  • SEARCH
  • Home
  • 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 8262543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:47:24+00:00 2026-06-08T03:47:24+00:00

I am using Python and Beautiful Soup to obtain url of available software from

  • 0

I am using Python and Beautiful Soup to obtain url of available software from Civic Commons – Social Media link. I want the link of all the Social Media software (spread across 20 pages). I am able to get the url of software listed in the first page.

Below is the Python code that I wrote for obtaining these values.

from bs4 import BeautifulSoup
import re
import urllib2

base_url = "http://civiccommons.org"
url = "http://civiccommons.org/software-functions/social-media"
page = urllib2.urlopen(url)
soup = BeautifulSoup(page.read())

list_of_links = [] 
for link_tag in soup.findAll('a', href=re.compile('^/apps/.*')):
   string_temp_link = base_url+link_tag.get('href')
   list_of_links.append(string_temp_link)

list_of_links = list(set(list_of_links))  

for link_item in list_of_links:
   print link_item

print ("\n")

#Newly added code to get all Next Page links from a url    
next_page_links = [] 
for link_tag in soup.findAll('a', href=re.compile('^/.*page=')):
   string_temp_link = base_url+link_tag.get('href')
   next_page_links.append(string_temp_link)
for next_page in next_page_links:
   print next_page

I used /apps/ regex to get the list of software.

But I wanted to know if there is better approach to crawl through next page. I am able to match the next page link by using regex “*page=”. But this gives repeated list of pages.

How can I do this in a better way?

  • 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-08T03:47:25+00:00Added an answer on June 8, 2026 at 3:47 am

    Looking at the page, there’s 5 pages, the last of which is “…?page=4”, so, we know there’s the first page, then page=1 through page=4…

    <li class="pager-last last">
    <a href="/software-licenses/gpl?page=4" title="Go to last page">last »</a>
    </li>
    

    So you could retrieve that by the class (or by title), then parse the href…

    from urlparse import urlparse, parse_qs
    for pageno in xrange(1, int(parse_qs(urlparse(url).query)['page'][0]) + 1):
        pass # do something useful here like building a url string with pageno
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using python's beautiful stone soup to extract data from this web page
Hi I am using python/beautiful soup to scrap information from foursquare's XML it seems
I am using Beautiful Soup 3.2 on python 2.7.1 here. I have recently been
I'm using beautiful soup (in Python). I have such hidden input object: <input type=hidden
I'd like to extract the text from an HTML file using Python. I want
I'm using Mechanize and Beautiful soup to scrape some data off Delicious from mechanize
I am parsing content using Python and Beautiful Soup then writing it to a
I'd like to extract the text from an HTML file using Python. I want
Beautiful Soup works in the Python shell using Django. I can also successfully import
Using Python, I want to know whether Java is installed.

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.