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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:52:54+00:00 2026-06-08T21:52:54+00:00

i’m trying to extract input fields from a website page and the page url

  • 0

i’m trying to extract input fields from a website page and the page url (which contain these inputs ) and store them into a database … ok
*** code works fine with no errors , but this isn't the desired output i want

spider code :

class MySpider(CrawlSpider):

    name = 'isa_spider'
    allowed_domains = ['testaspnet.vulnweb.com']
    start_urls = ['http://testaspnet.vulnweb.com']

    rules = (
                Rule(SgmlLinkExtractor(allow=('/*' ) ),callback='parse_item'),)

    def parse_item(self, response):

        hxs = HtmlXPathSelector(response)
        item=IsaItem()
        item['response_fld']=response.url

        res = hxs.select("//input[(@id or @name) and (@type = 'text' )]/@id ").extract()
        item['text_input'] = res[0] if res else None # None is default value in case no field found

        res = hxs.select("//input[(@id or @name) and (@type = 'password')]/@id").extract()
        item['pass_input'] = res[0] if res else None # None is default value in case no field found

        res = hxs.select("//input[(@id or @name) and (@type = 'file')]/@id").extract()
        item['file_input'] = res[0] if res else None # None is default value in case no field found

        return item

pipeline code

    class SQLiteStorePipeline(object):


        def __init__(self):
            self.conn = sqlite3.connect('./project.db')
            self.cur = self.conn.cursor()


        def process_item(self, item, spider):

            self.cur.execute("insert into inputs ( input_name) values(?)", (item['text_input'],))
            self.cur.execute("insert into inputs ( input_name) values(?)", (item['pass_input'],))
            self.cur.execute("insert into inputs ( input_name) values(?)", (item['file_input'],))
            self.cur.execute("insert into links (link) values(?)", (item['response_fld'],))
            self.conn.commit()
            return item

database schema picture

required output picture
(sorry for not inserting images directly since my reputation is less than 10)

  • 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-08T21:52:55+00:00Added an answer on June 8, 2026 at 9:52 pm

    Haven’t tested this:

    class SQLiteStorePipeline(object):
    
    
        def __init__(self):
            self.conn = sqlite3.connect('./project.db')
            self.cur = self.conn.cursor()
    
    
        def process_item(self, item, spider):
    
            cursor = self.cur
    
            target_id = ? # determine target id
            cursor.execute("insert into links (target, link) values(?, ?)", (target_id, item['response_fld'],))
            link_id = cursor.lastrowid # find out just inserted link id
    
            cursor.execute("insert into inputs (link_id, input_name, input_type) values(?, ?, ?)", (link_id, item['text_input'], 1))
            cursor.execute("insert into inputs (link_id, input_name, input_type) values(?, ?, ?)", (link_id, item['pass_input'], 2))
            cursor.execute("insert into inputs (link_id, input_name, input_type) values(?, ?, ?)", (link_id, item['file_input'], 3))
    
            self.conn.commit()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I used javascript for loading a picture on my website depending on which small
I have a text area in my form which accepts all possible characters from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to render a haml file in a javascript response like so:

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.