473,543 Members | 1,970 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3245
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*@somew here.com',
| 'y**@somewhere. com',
| 'eBay Search Results',
| results)
|
|def SearchEbay(sear chstrings):
| ' 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(searc hstrings)):
|
| # 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('item s 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('y our.smtp.server .here')
| server.set_debu glevel(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*@somew here.com',
| 'y**@somewhere. com',
| 'eBay Search Results',
| results)
|
|def SearchEbay(sear chstrings):
| ' 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(searc hstrings)):
|
| # 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('item s 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('y our.smtp.server .here')
| server.set_debu glevel(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
4289
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! the funny thing was eBay was one of the major case studies for .NET at the beginning, when there was still some hype about it. interesting post...
2
2668
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 do I have to pay redirection.net?
14
4609
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 eBay, Yahoo and others. This is what she wants my program to be able to do: (try this test at different websites just for fun). At eBay: -...
2
2220
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" function, there's a use of self.Session.Server. Where is this property coming from?
20
24959
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
1784
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 default, that disappears immediately you click in the text box. I have looked at the source code for the page but nothing is jumping out at
0
2368
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 width="100%" border=0> <TBODY>
13
36074
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 function. --
0
7355
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7594
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7748
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7697
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5892
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4900
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3395
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1830
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
648
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.