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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:18:19+00:00 2026-06-05T09:18:19+00:00

I’m working on a school project currently which aim goal is to analyze scam

  • 0

I’m working on a school project currently which aim goal is to analyze scam mails with the Natural Language Toolkit package. Basically what I’m willing to do is to compare scams from different years and try to find a trend – how does their structure changed with time.
I found a scam-database: http://www.419scam.org/emails/
I would like to download the content of the links with python, but I am stuck.
My code so far:

from BeautifulSoup import BeautifulSoup
import urllib2, re

html = urllib2.urlopen('http://www.419scam.org/emails/').read()
soup = BeautifulSoup(html)
links = soup.findAll('a')

links2 = soup.findAll(href=re.compile("index"))

print links2

So I can fetch the links but I don’t know yet how can I download the content. Any ideas? Thanks a lot!

  • 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-05T09:18:22+00:00Added an answer on June 5, 2026 at 9:18 am

    You’ve got a good start, but right now you’re simply retrieving the index page and loading it into the BeautifulSoup parser. Now that you have href’s from the links, you essentially need to open all of those links, and load their contents into data structures that you can then use for your analysis.

    This essentially amounts to a very simple web-crawler. If you can use other people’s code, you may find something that fits by googling “python Web crawler.” I’ve looked at a few of those, and they are straightforward enough, but may be overkill for this task. Most web-crawlers use recursion to traverse the full tree of a given site. It looks like something much simpler could suffice for your case.

    Given my unfamiliarity with BeautifulSoup, this basic structure will hopefully get you on the right path, or give you for a sense for how the web crawling is done:

    from BeautifulSoup import BeautifulSoup
    import urllib2, re
    
    emailContents = []
    
    def analyze_emails():
        # this function and any sub-routines would analyze the emails after they are loaded into a data structure, e.g. emailContents
    
    def parse_email_page(link):
        print "opening " + link
        # open, soup, and parse the page.  
        #Looks like the email itself is in a "blockquote" tag so that may be the starting place.  
        #From there you'll need to create arrays and/or dictionaries of the emails' contents to do your analysis on, e.g. emailContents
    
    def parse_list_page(link):
        print "opening " + link
        html = urllib2.urlopen(link).read()
        soup = BeatifulSoup(html)
        email_page_links = # add your own code here to filter the list page soup to get all the relevant links to actual email pages   
        for link in email_page_links:
            parseEmailPage(link['href'])
    
    
    def main():
        html = urllib2.urlopen('http://www.419scam.org/emails/').read()
        soup = BeautifulSoup(html)    
        links = soup.findAll(href=re.compile("20")) # I use '20' to filter links since all the relevant links seem to have 20XX year in them. Seemed to work
    
        for link in links:
            parse_list_page(link['href'])
    
        analyze_emails()         
    
    if __name__ == "__main__":
        main()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I am currently running into a problem where an element is coming back from
I'm working with an upstream system that sometimes sends me text destined for HTML/XML

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.