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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:28:49+00:00 2026-05-23T20:28:49+00:00

I am trying to scrape form field IDs using Beautiful Soup like this for

  • 0

I am trying to scrape form field IDs using Beautiful Soup like this

 for link in BeautifulSoup(content, parseOnlyThese=SoupStrainer('input')):
    if link.has_key('id'):
        print link['id']

Lets us assume that it returns something like

username
email
password
passwordagain
terms
button_register

I would like to write this into Sqlite3 DB.

What I will be doing down the line in my application is… Use these form fields’ IDs and try to do a POST may be. The problem is.. there are plenty of sites like this whose form field IDs I have scraped. So the relation is like this…

Domain1 - First list of Form Fields for this Domain1
Domain2 - Second list of Form Fields for this Domain2
.. and so on

What I am unsure here is… How should I design my column for this kind of purpose? Will it be OK if I just create a table with two columns – say

COL 1 - Domain URL (as TEXT)
COL 2 - List of Form Field IDs (as TEXT)

One thing to be remembered is… Down the line in my application I will need to do something like this…

Pseudocode

If Domain is "http://somedomain.com":
    For ever item in the COL2 (which is a list of form field ids):
         Assign some set of values to each of the form fields & then make a POST request

Can any one guide, please?

EDITed on 22/07/2011 – Is My Below Database Design Correct?

I have decided to have a solution like this. What do you guys think?

I will be having three tables like below

Table 1

Key Column (Auto Generated Integer) - Primary Key
Domain as TEXT

Sample Data would be something like:

1   http://url1.com
2   http://url2.com
3   http://url3.com

Table 2

Domain (Here I will be using the Key Number from Table 1)
RegLink - This will have the registeration link (as TEXT)
Form Fields (as Text)

Sample Data would be something like:

1   http://url1.com/register    field1
1   http://url1.com/register    field2
1   http://url1.com/register    field3
2   http://url2.com/register    field1
2   http://url2.com/register    field2
2   http://url2.com/register    field3
3   http://url3.com/register    field1
3   http://url3.com/register    field2
3   http://url3.com/register    field3

Table 3

Domain (Here I will be using the Key Number from Table 1)
Status (as TEXT)
User (as TEXT)
Pass (as TEXT)

Sample Data would be something like:

1   Pass    user1   pass1
2   Fail    user2   pass2
3   Pass    user3   pass3

Do you think this table design is good? Or are there any improvements that can be made?

  • 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-23T20:28:50+00:00Added an answer on May 23, 2026 at 8:28 pm

    Try this to get the ids:

    ids = (link['id'] for link in
            BeautifulSoup(content, parseOnlyThese=SoupStrainer('input')) 
             if link.has_key('id'))
    

    And this should show you how to save them, load them, and do something to each. This uses a single table and just inserts one row for each field for each domain. It’s the simplest solution, and perfectly adequate for a relatively small number of rows of data.

    from itertools import izip, repeat
    import sqlite3
    
    conn = sqlite3.connect(':memory:')
    c = conn.cursor()
    c.execute('''create table domains
    (domain text, linkid text)''')
    
    domain_to_insert = 'domain_name'
    ids = ['id1', 'id2']
    c.executemany("""insert into domains
          values (?, ?)""", izip(repeat(domain_to_insert), ids))
    conn.commit()
    
    domain_to_select = 'domain_name'
    c.execute("""select * from domains where domain=?""", (domain_to_select,))
    
    # this is just an example
    def some_function_of_row(row):
        return row[1] + ' value'
    
    fields = dict((row[1], some_function_of_row(row)) for row in c)
    print fields
    c.close()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to scrape the price field from this website using the HTML Agility
Trying to do this sort of thing... WHERE username LIKE '%$str%' ...but using bound
I am trying to scrape some content from an HTML page. I'm using libxml2
I'm trying to scrape this link: https://www.bu.edu/link/bin/uiscgi_studentlink/1293403322?College=SMG&Dept=AC&Course=222&Section=C1&Subject=ACCT &MtgDay=&MtgTime=&ModuleName=univschr.pl&KeySem=20114&ViewSem=Spring+2011&SearchOptionCd=C&SearchOptionDesc=Class+Subject&MainCampusInd=. (It works fine if you access
I'm trying to scrape a price from a web page using PHP and Regexes.
Trying to get my css / C# functions to look like this: body {
I'm trying to scrape some content off another site and I'm not sure why
I'm trying do scrape this website with python and lxml. Its working greate on
I'm trying to scrape a remote website. I'm using PHP Curl, and my code
I am trying to get the text from a page scrape using xpath, now

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.