Thursday, 21 August 2014

Web Scraping data from different sites


I am looking for a few ideas on how can I solve a design problem I'm going to be faced with building a web scraper to scrape multiple sites. Writing the scraper(s) is not the problem, matching the data from different sites (which may have small differences) is.

For the sake of being generic assume that I am scraping something like this from two or more different sites:

    public class Data {
        public int id;
        public String firstname;
        public String surname;
        ....
    }

If i scrape this from two different sites, I will encounter the situation where I could have the following:

Site A: id=100, firstname=William, surname=Doe

Site B: id=1974, firstname=Bill, surname=Doe

Essentially, I would like to consider these two sets of data the same (they are the same person but with their name slightly different on each site). I am looking for possible design solutions that can handle this.

The only idea I've come up with is scraping the data from a third location and using it as a reference list. Then when I scrape site A or B I can, over time, build up a list of failures and store them in a list for each scraper so that it can know (if i find id=100 then i know that the firstname will be William etc). I can't help but feel this is a rubbish idea!

If you need any more info, or if you think my description is a bit naff, let me know!

Thanks,

DMcB


Source: http://stackoverflow.com/questions/23970057/web-scraping-data-from-different-sites

Wednesday, 20 August 2014

Scrape Data Point Using Python


I am looking to scrape a data point using Python off of the url http://www.cavirtex.com/orderbook .

The data point I am looking to scrape is the lowest bid offer, which at the current moment looks like this:

<tr>
 <td><b>Jan. 19, 2014, 2:37 a.m.</b></td>
 <td><b>0.0775/0.1146</b></td>
 <td><b>860.00000</b></td>
 <td><b>66.65 CAD</b></td>
</tr>

The relevant point being the 860.00 . I am looking to build this into a script which can send me an email to alert me of certain price differentials compared to other exchanges.

I'm quite noobie so if in your explanations you could offer your thought process on why you've done certain things it would be very much appreciated.

Thank you in advance!

Edit: This is what I have so far which will return me the name of the title correctly, I'm having trouble grabbing the table data though.

import urllib2, sys
from bs4 import BeautifulSoup

site= "http://cavirtex.com/orderbook"
hdr = {'User-Agent': 'Mozilla/5.0'}
req = urllib2.Request(site,headers=hdr)
page = urllib2.urlopen(req)
soup = BeautifulSoup(page)
print soup.title



Here is the code for scraping the lowest bid from the 'Buying BTC' table:

from selenium import webdriver

fp = webdriver.FirefoxProfile()
browser = webdriver.Firefox(firefox_profile=fp)
browser.get('http://www.cavirtex.com/orderbook')

lowest_bid = float('inf')
elements = browser.find_elements_by_xpath('//div[@id="orderbook_buy"]/table/tbody/tr/td')

for element in elements:
    text = element.get_attribute('innerHTML').strip('<b>|</b>')
    try:
        bid = float(text)
        if lowest_bid > bid:
            lowest_bid = bid
    except:
        pass

browser.quit()
print lowest_bid

In order to install Selenium for Python on your Windows-PC, run from a command line:

pip install selenium (or pip install selenium --upgrade if you already have it).

If you want the 'Selling BTC' table instead, then change "orderbook_buy" to "orderbook_sell".

If you want the 'Last Trades' table instead, then change "orderbook_buy" to "orderbook_trades".

Note:

If you consider performance critical, then you can implement the data-scraping via URL-Connection instead of Selenium, and have your program running much faster. However, your code will probably end up being a lot "messier", due to the tedious XML parsing that you'll be obliged to apply...

Here is the code for sending the previous output in an email from yourself to yourself:

import smtplib,ssl

def SendMail(username,password,contents):
    server = Connect(username)
    try:
        server.login(username,password)
        server.sendmail(username,username,contents)
    except smtplib.SMTPException,error:
        Print(error)
    Disconnect(server)

def Connect(username):
    serverName = username[username.index("@")+1:username.index(".")]
    while True:
        try:
            server = smtplib.SMTP(serverDict[serverName])
        except smtplib.SMTPException,error:
            Print(error)
            continue
        try:
            server.ehlo()
            if server.has_extn("starttls"):
                server.starttls()
                server.ehlo()
        except (smtplib.SMTPException,ssl.SSLError),error:
            Print(error)
            Disconnect(server)
            continue
        break
    return server

def Disconnect(server):
    try:
        server.quit()
    except smtplib.SMTPException,error:
        Print(error)

serverDict = {
    "gmail"  :"smtp.gmail.com",
    "hotmail":"smtp.live.com",
    "yahoo"  :"smtp.mail.yahoo.com"
}

SendMail("your_username@your_provider.com","your_password",str(lowest_bid))

The above code should work if your email provider is either gmail or hotmail or yahoo.

Please note that depending on your firewall configuration, it may ask your permission upon the first time you try it...



Source: http://stackoverflow.com/questions/21217034/scrape-data-point-using-python

Sunday, 17 August 2014

Has It Been Done Before? Optimize Your Patent Search Using Patent Scraping Technology

Has it been done before? Optimize your Patent Search using Patent Scraping Technology.

Since the US patent office opened in 1790, inventors across the United States have been submitting all sorts of great products and half-baked ideas to their database. Nowadays, many individuals get ideas for great products only to have the patent office do a patent search and tell them that their ideas have already been patented by someone else! Herin lies a question: How do I perform a patent search to find out if my invention has already been patented before I invest time and money into developing it?

The US patent office patent search database is available to anyone with internet access.

US Patent Search Homepage


Performing a patent search with the patent searching tools on the US Patent office webpage can prove to be a very time consuming process. For example, patent searching the database for "dog" and "food" yields 5745 patent search results. The straight-forward approach to investigating the patent search results for your particular idea is to go through all 5745 results one at a time looking for yours. Get some munchies and settle in, this could take a while! The patent search database sorts results by patent number instead of relevancy. This means that if your idea was recently patented, you will find it near the top but if it wasn't, you could be searching for quite a while. Also, most patent search results have images associated with them. Downloading and displaying these images over the internet can be very time consuming depending on you internet connection and the availability of the patent search database servers.

Because patent searches take such a long time, many companies and organizations are looking ways to improve the process. Some organizations and companies will hire employees for the sole purpose of performing patent searches for them. Others contract out the job to small business that specialize in patent searches. The latest technology for performing patent searches is called patent scraping.

Patent scraping is the process of writing computer automated scripts that analyze a website and copy only the content you are interested in into easily accessible databases or spreadsheets on your computer. Because it is a computerized script performing the patent search, you don't need a separate employee to get the data, you can let it run the patent scraping while you perform other important tasks! Patent scraping technology can also extract text content from images. By saving the images and textual content to your computer, you can then very efficiently search them for content and relevancy; thus saving you lots of time that could be better spent actually inventing something!

To put a real-world face on this, let us consider the pharmaceutical industry. Many different companies are competing for the patent on the next big drug. It has become an indispensible tactic of the industry for one company to perform patent searches for what patents the other companies are applying for, thus learning in which direction the research and development team of the other company is taking them. Using this information, the company can then choose to either pursue that direction heavily, or spin off in a different direction. It would quickly become very costly to maintain a team of researchers dedicated to only performing patent searches all day. Patent scraping technology is the means for figuring out what ideas and technologies are coming about before they make headline news. It is by utilizing patent scraping technology that the large companies stay up to date on the latest trends in technology.

While some companies choose to hire their own programming team to do their patent scraping scripts for them, it is much more cost effective to contract out the job to a qualified team of programmers dedicated to performing such services.

Source:http://ezinearticles.com/?Has-It-Been-Done-Before?-Optimize-Your-Patent-Search-Using-Patent-Scraping-Technology&id=171000

Tuesday, 12 August 2014

Collecting Data With Web Scrapers

There is a large amount of data available only through websites. However, as many people have found out, trying to copy data into a usable database or spreadsheet directly out of a website can be a tiring process. Data entry from internet sources can quickly become cost prohibitive as the required hours add up. Clearly, an automated method for collating information from HTML-based sites can offer huge management cost savings.

Web scrapers are programs that are able to aggregate information from the internet. They are capable of navigating the web, assessing the contents of a site, and then pulling data points and placing them into a structured, working database or spreadsheet. Many companies and services will use programs to web scrape, such as comparing prices, performing online research, or tracking changes to online content.

Let's take a look at how web scrapers can aid data collection and management for a variety of purposes.

Improving On Manual Entry Methods

Using a computer's copy and paste function or simply typing text from a site is extremely inefficient and costly. Web scrapers are able to navigate through a series of websites, make decisions on what is important data, and then copy the info into a structured database, spreadsheet, or other program. Software packages include the ability to record macros by having a user perform a routine once and then have the computer remember and automate those actions. Every user can effectively act as their own programmer to expand the capabilities to process websites. These applications can also interface with databases in order to automatically manage information as it is pulled from a website.

Aggregating Information

There are a number of instances where material stored in websites can be manipulated and stored. For example, a clothing company that is looking to bring their line of apparel to retailers can go online for the contact information of retailers in their area and then present that information to sales personnel to generate leads. Many businesses can perform market research on prices and product availability by analyzing online catalogues.

Data Management

Managing figures and numbers is best done through spreadsheets and databases; however, information on a website formatted with HTML is not readily accessible for such purposes. While websites are excellent for displaying facts and figures, they fall short when they need to be analyzed, sorted, or otherwise manipulated. Ultimately, web scrapers are able to take the output that is intended for display to a person and change it to numbers that can be used by a computer. Furthermore, by automating this process with software applications and macros, entry costs are severely reduced.

This type of data management is also effective at merging different information sources. If a company were to purchase research or statistical information, it could be scraped in order to format the information into a database. This is also highly effective at taking a legacy system's contents and incorporating them into today's systems.

Overall, a web scraper is a cost effective user tool for data manipulation and management.

Source:http://ezinearticles.com/?Collecting-Data-With-Web-Scrapers&id=4223877

Friday, 1 August 2014

Article Writing Services and Article Ghostwriting Benefits

Article writing services and article ghostwriting can offer you more benefits than you might expect. With Google Penguin 2 now prowling around the web, it is essential that your web content is written with a high degree of knowledge of the Google algorithm updates.

Panda and Penguin were bad enough, but Penguin 2 is hunting down web pages that are 'over optimized' in Google's opinion. Google is also targeting content that is not original. Not necessarily just duplicate content, but also scraped content

This is not something to ignore, as many ignored the first issue of Penguin. It should be taken seriously, so here are some tips how to avoid having your web pages and blog posts lose their current ranking. Whether you use article writing services or do it yourself, here are some of the benefits that article ghostwriting services can offer.

Keyword Density

There is no such thing anymore. Many will insist that you must have at least 2% KD on your web page for Google to list it. Nonsense! Google will decide itself what the theme of your page is - if you have written badly, then the algorithms will possibly get the wrong message and you are toast! That is what LSI is about. Latent Semantic Indexing is about indexing your page for the semantic meaning of the vocabulary used on it.

This means that you can have a #1 ranked page for a search term (keyword) that does not even appear in the content of that page! Google uses semantic relevance to search terms used by Google clients - those using it as a search engine to find information. Many internet marketers have forgotten that Google is first and foremost a search engine and not an advertising platform!

Article Writing Services and Semantic Relevance

Those offering professional article writing services are fully aware of Google's needs, and can design the content of your individual web pages around these needs. Article ghostwriting involves professional article writing in your name. They will still ensure that your content has a keyword density of around 0.7% - 1.0%, or even more when warranted.

That is because you cannot always use synonyms with the exact semantic relevance you need. There are sometimes situations, or topics, where it is difficult to use synonyms with the same semantic meaning as the main theme of the page. To do this, you need a good knowledge of the language of your site.

In these cases, professional article writing services can adjust the keyword usage (KD) to ensure that the algorithms (crawlers/spiders) have the character strings (data) to correspond with their programmed data - the data that assesses the relevance of your web page with the search term employed. SEO content writing is both a science and a art.

Article Ghostwriting Benefits

That said, the benefits of article ghostwriting should be apparent. You avoid the claws (or webs) of Penguin2 by avoiding over-optimization of your web pages. You also get professional SEO content writing that is 100% original - so no duplicate content issues. This is another issue that Google algorithms are now punishing severely. Your content must be 100% original.

Scraped Content Software

You have no doubt come across software that scrapes the web and generates articles from existing content. Terms such as 'article scraper,' 'instant article,' 'article wizard,' and so on involve the copying of copyrighted material to generate a so-called 'unique' article for you.

Not only is the legality of this dubious, but Google algorithms are now searching such software-generated articles out, and delisting them. They won't tell you that of course, and major article directories are also taking action against such scraped articles.

If you are using this type of software, or have websites containing it, then your Google ranking might disappear overnight. It has already happened, and is likely happening all the time now that the Penguins are on the hunt. Original content is, and always will be, king!

Original SEO Content is King

Article writing services can offer you 100% original content without you worrying about future Google algorithm updates. Article ghostwriting ensures that only you have the article provided to you and that it is published in your name as author. No need to cheat and no need to worry about your online business failing with the next Google update - or even when Penguin2 catches on.

Source:http://ezinearticles.com/?Article-Writing-Services-and-Article-Ghostwriting-Benefits&id=8004387

Monday, 14 July 2014

Online Data Entry - How Online Data Entry is Useful in Business?

In last article about "Online Data Entry Projects - Grab An Online Audience by Data Entry", I mentioned some newly provoked ideas which are currently outsourced by various companies around the world such as United States, United Kingdom, United Arab Emirates, Canada and Others. In this article, I emphasize on some symbolized and basic online data entry techniques that most of the businesses require. Here we go:

Online Compilation from Websites: Company requires a huge amount of information to run business smoothly. You require details of raw material suppliers, Machine suppliers, maintenance service vendor, product dispenser and many more. If company executive have compiled information, they can act promptly and complete the task quickly. Online websites are great source to search for particular details. By outsourcing online compilation from website task to some reputed data entry company, you can get highly accurate information that helps you in taking powerful decisions.

Online Business Card Entry: Business Cards are much helpful not only in getting a better idea about business of someone but also getting the contact information easily. Sometimes it happens that you misplace the business card when you require it urgently. If you have entered business card information in your PC, you can easily search for such. You can quickly contact the needed person and solve your queries promptly.

Online Catalog Data Entry: Catalog is the most powerful tool to sell your products. If you don't have informative and attractive catalog, you can not convert your viewers into customers. It is also possible that you are avoiding online potential customer by not uploading your catalog online. However, online catalog data entry can be the solution for such need. Insert good amount of information in your catalog and attract more visitors. You can get not only good business from this but also provoke your brand.

Online Survey Form Entry: Survey is very important tool to check the mindset of customers. The data mention in survey forms are very important while upgrading product, emerging into new field, changing strategy, branding and marketing products. The information is only useful if it is precise and quickly available. Online survey form entry can help you in making surveyed information organized so that you can clearly divert your focus on right direction.

These are various online data typing projects which are helpful for your business to generate more efficient environment and increase the productivity and profitability. You can meet high goals with efficient environment and increased productivity.

Source: http://ezinearticles.com/?Online-Data-Entry---How-Online-Data-Entry-is-Useful-in-Business?&id=4505450

Thursday, 10 July 2014

Complete SEO Services Introduces Affordable Content Writing Services for Effective SEO

Complete SEO Services, one of the UK’s leading search engine optimization companies has introduced an article-writing service for effective SEO. The UK based SEO company who has a vast amount of knowledge of how professional content can help with the improvement of traffic and search engine rankings have put that knowledge together with their professional writing team and launched a content writing service for effective SEO.

The new content writing service is aimed at helping marketing companies and website owners achieve their SEO goals. Content is king is a popular saying with professional website marketing companies and the saying has become even truer with all the changes that popular search engines have made to the way they rank websites. Offering quality articles that are well written and engage the target audience will not only help drive more traffic to the website and keep people on their for longer, it will also encourage search engines to rank the site higher.

A spokesman for Complete SEO Services said: “For SEO to be effective the website needs to have quality content. There are a lot of companies out there who offer spinning articles that can damage a website. A site needs to have up to date content that has been professionally written to keep visitors returning and to help improve search engine rankings.”

The SEO Services Company writes articles for companies all around the world from small businesses to large companies, but providing the same quality service no matter what size business they are.

Website owners have seen how all the recent changes with popular search engines have changed the way their sites have been ranked. With search engines now concentrating on sites that offer quality content, it is important to make sure websites have up to date content that has been written by professionals to help with positive SEO.

Source: http://digitaljournal.com/pr/1973692