473,387 Members | 1,455 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

script to search ebay?

Hi all,

Anyone know where I can find a python script to search ebay? I
have been looking around but haven't found anything. I know
there must be one somewhere so I am probably just looking in the
wrong places. Optimally, I would like the script to search ebay
and then send an email out with the results.

Lance
Jul 18 '05 #1
2 3231
This script works. But why not make a 'Favorite Search' in ebay, and
have it send you daily email for a year?

--Kamilche

|import urllib
|import smtplib
|
|def main():
| # Perform the search
| results = SearchEbay(['So long and thanks for all the fish',
| 'NOMATCHFOUND',
| 'Python Programming'])
|
| # Email the results
| Email('m*@somewhere.com',
| 'y**@somewhere.com',
| 'eBay Search Results',
| results)
|
|def SearchEbay(searchstrings):
| ' Search eBay for the desired items'
| searchURL = "http://search.ebay.com/%s"
| results = ""
| s = "eBay Search Results:\n"
| print s,
| results += s
| for i in range(len(searchstrings)):
|
| # Build the search URL
| search = searchstrings[i].replace(' ', '-')
| s = searchURL % search + " : "
| print s,
| results += s
|
| # Download the URL
| url = urllib.urlopen(searchURL % search)
| data = url.read()
| url.close()
|
| # Write the URL to a file for debugging
| fd = open('ebay %d.html' % i, 'w')
| fd.write(data)
| fd.close()
|
| # Search for the number of items found
| c = data.find('items found for')
| if c >= 0:
| start = data.rfind('<b>', 0, c) + 3
| stop = data.find('</b>', start + 1)
| cnt = data[start:stop]
| else:
| cnt = '0'
| s = "%s items found.\n" % cnt
| print s,
| results += s
|
| return results
|
|def Email(fromaddr, toaddr, subject, msg):
| ' Send email'
| msg = ("From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n%s" % \
| (fromaddr, toaddr, subject, msg))
| server = smtplib.SMTP('your.smtp.server.here')
| server.set_debuglevel(1)
| server.sendmail(fromaddr, toaddr, msg)
| server.quit()
|
|main()

Jul 18 '05 #2
Thanks for the script. I haven't been on ebay for a while.
Wasn't aware of the Favorite searches. Favorite Search is
probably the way to go. Thanks for the info.

Lance
On Tue, 25 Jan 2005 22:57:54 -0800, Kamilche wrote:
This script works. But why not make a 'Favorite Search' in ebay, and
have it send you daily email for a year?

--Kamilche

|import urllib
|import smtplib
|
|def main():
| # Perform the search
| results = SearchEbay(['So long and thanks for all the fish',
| 'NOMATCHFOUND',
| 'Python Programming'])
|
| # Email the results
| Email('m*@somewhere.com',
| 'y**@somewhere.com',
| 'eBay Search Results',
| results)
|
|def SearchEbay(searchstrings):
| ' Search eBay for the desired items'
| searchURL = "http://search.ebay.com/%s"
| results = ""
| s = "eBay Search Results:\n"
| print s,
| results += s
| for i in range(len(searchstrings)):
|
| # Build the search URL
| search = searchstrings[i].replace(' ', '-')
| s = searchURL % search + " : "
| print s,
| results += s
|
| # Download the URL
| url = urllib.urlopen(searchURL % search)
| data = url.read()
| url.close()
|
| # Write the URL to a file for debugging
| fd = open('ebay %d.html' % i, 'w')
| fd.write(data)
| fd.close()
|
| # Search for the number of items found
| c = data.find('items found for')
| if c >= 0:
| start = data.rfind('<b>', 0, c) + 3
| stop = data.find('</b>', start + 1)
| cnt = data[start:stop]
| else:
| cnt = '0'
| s = "%s items found.\n" % cnt
| print s,
| results += s
|
| return results
|
|def Email(fromaddr, toaddr, subject, msg):
| ' Send email'
| msg = ("From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n%s" % \
| (fromaddr, toaddr, subject, msg))
| server = smtplib.SMTP('your.smtp.server.here')
| server.set_debuglevel(1)
| server.sendmail(fromaddr, toaddr, msg)
| server.quit()
|
|main()


Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

37
by: asj | last post by:
awhile back, eBay decided to switch from a Microsoft/.NET/Windows architecture on the backend to a J2EE one, which might explain why their java backend will handle up to 1 BILLION page views a day!...
2
by: Nymphetamine | last post by:
<script language="JavaScript"> if (parent.frames.length==0) { location.href = "" } </script I use the above script to redirect websites but is there any script that can hide the new url? or...
14
by: vic | last post by:
My manager wants me to develop a search program, that would work like they have it at edorado.com. She made up her requirements after having compared how search works at different websites, like...
2
by: provato | last post by:
I'm somewhat of a newbie was confused by the following code that I downloaded from eBay's developer site: One of the classes in the file is called "Call". What I don't get is that in "MakeCall"...
20
by: Tammy | last post by:
What would be a good alternative to using frames? I need something that will section my webpage into two halves and can change both frames on a single click. Thanks in Advance, Tammy
6
by: Mark | last post by:
Hi all I want to recreate the search box that is at the top right of most eBay pages. The aspect that I am specifically talking about, is the "START NEW SEARCH" test that is in the box by...
0
by: eBay-Mitglied gret | last post by:
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0> <TBODY> <TR> <TD> <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0> <TBODY> <TR> <TD> <TABLE cellSpacing=0 cellPadding=2...
13
by: Ralph | last post by:
Hi Is it possible to trigger the certain event from JS function? I have an image with on click event handler assigned. Now if like to trigger this event for this image from some other...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.