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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:23:50+00:00 2026-05-26T00:23:50+00:00

I am writing a web scraper that grabs content from decade articles from wikipedia.

  • 0

I am writing a web scraper that grabs content from decade articles from wikipedia. (e.g. articles on the 10s, the 1970s, the 1670s BC, and so on.)

I am using logic that resembles this to grab the pages.

for (i = -1690; i <= 2010; i += 10)
    if (i < 0)
        page = (-i) + "s_BC"
    else
        page = i + "s"
    GrabContentFromURL("http://en.wikipedia.org/wiki/" + page)

This is working, except for one little detail that I hadn’t considered.

The problem is that there are two 0s decades. There is a 0s AD and a 0s BC. With the way my loop currently works, the program only grabs the content from the 0s AD page.

This is a pretty simple problem, but I’m having a hard time coming up with a very nice way to fix it. I know I can extract the body of the loop to a separate function and use two separate loops, but I feel like there’s a more elegant way to do this that I’m missing.

How can I fix this problem without introducing too much complexity?

  • 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-05-26T00:23:50+00:00Added an answer on May 26, 2026 at 12:23 am

    You mind hitting a few 404 pages along the way?

    for (i = 0; i <= 2010; i+=10)
        GrabContentFromURL("http://en.wikipedia.org/wiki/" + i + "s")
        GrabContentFromURL("http://en.wikipedia.org/wiki/" + i + "s_BC")
    end
    

    If the answer to that question was “yes, I mind” then you can still toss in some ifs:

    for (i = 0; i <= 2010; i+=10)
        GrabContentFromURL("http://en.wikipedia.org/wiki/" + i + "s")
        if (i < 1690)
            GrabContentFromURL("http://en.wikipedia.org/wiki/" + i + "s_BC")
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a web app that inserts and modifies HTML elements via AJAX using
I'm writing a web scraper in python, using httplib2 and lxml (yes - I
While reading some articles about writing web servers using Twisted , I came across
I'm writing a web application that constantly retrieves XML components from a database and
I find that writing web apps and WinForm apps generally come out a lot
I writing a web site that uses Active Directory to validate users. I don't
I'm writing a web app that points to external links. I'm looking to create
I am writing a web application that requires user interaction via email. I'm curious
I'm writing a Java program that scrapes a web page for links and then
I'm writing web application that uses Spring MVC to bind Spring beans with REST-like

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.