Wednesday, 11 May 2016

Web Scraping to Create Open Data

Open data is the idea that some data should be freely available to everyone to use and republish as they wish, without restrictions from
copyright, patents or other mechanisms of control.

My first experience with open data was in the year 2010. I wanted to create a better app for Bicing, the local bike sharing system in
Barcelona. Their website was a nightmare to use and I was tired of needing to walk to each station, trying to guess which ones had bicycles.
There was no app for Android, other than a couple of unofficial attempts that didn’t work at all.

I began as most would; I searched the internet and found a library named python-bicing that was somehow able to retrieve station and
bike information. This was my first time using Python and, after some investigation, I learned what the code was doing: accessing the
official website, parsing the JavaScript that generated their buggy map and giving back a nice chunk of Python objects that represented
bike share stations.

This I learned was called web scraping. It was like I had figured out a magic trick that would allow me to always be able to access the data I
needed without having to rely on faulty websites.

The rise of OpenBicing and CityBikes

Shortly after, I launched OpenBicing, an Android app for the local bike sharing system in Barcelona, together with a backend that used
python-bicing. I also shared a public API that provided this information so that nobody else had to do the dirty work ever again.

Since other cities were having the same problem, we expanded the scope of the project worldwide and renamed it City Bikes. That was 6
years ago.

To date, City Bikes is the most comprehensive and widely used open API for bike sharing information, with support for over 400 cities
worldwide. Our API processes around 10 requests per second and we scrape each of the 418 feeds about every three minutes. Making our
core library available for anyone to contribute has been crucial in maintaining and adding coverage for all of the supported systems.

The open data fallacy

We are usually regarded as “an open data project” even though less than 10% of our feeds come from properly licensed, documented and
machine-readable feeds. The remaining 90% is composed of 188 feeds that are machine-readable, but not licensed nor documented and
230 that are entirely maintained by scraping HTML pages.

North American Bike Share Association) recently published GBFS (General Bikeshare Feed Specification). This is clearly a step in the right
direction, but I can’t help but look at the almost 60% of services we currently support through scraping and wonder how long it will take the
remaining organizations to release their information, if ever. This is even more the case considering these numbers aren’t even taking into
account worldwide coverage.

Over the last few years there has been a progression by transportation companies and city councils toward providing their information as
“open data”. Directive 2003/98/EC encourages EU member states to release information regarding public services.

Yet, in most cases, there’s little action in enforcing Public Private Partnerships (PPP) to release their public information under a non-
restrictive license or even to transfer ownership of the data to city councils to be included in their open data portals.

Even with the increasing number of companies and institutions interested in participating in open data, by no means should we consider
open data a reality or something to be taken for granted. I firmly believe in the future and benefits of open data, I have seen them
happening all around City Bikes, but as technologists we need to stress the fact that the data is not out there yet.

The benefits of open data

When I started this project, I sought to make a difference in Barcelona. Now you can find tons of bike sharing apps that use our API on all
major platforms. It doesn’t matter that these are not our own apps. They are solving the same problem we were trying to fix, so their
success is our success.

Besides popular apps like Moovit or City Mapper, there are many neat projects out there, some of which are published under free software
licenses. Ideally, a city council could create a customization of any of these apps for their own use.

Most official applications for bike sharing systems have terrible ratings. The core business of transportation companies is running a service,

so they have no real motivation to create an engaging UI or innovate further. In some cases, the city council does not even own the rights to
the data, being completely at the mercy of the company providing the transportation service.

Open data over apps

When providing public services, city councils and companies often get lost in what they should offer as an aid to the service. They focus on
a nice map or a flashy application, rather than providing the data behind these service aids. Maps, apps, and websites have a limited focus
and usually serve a single purpose. On the other hand, data is malleable and the purest form of representation. While you can’t create
something new from looking and playing with a static map (except, of course, if you scrape it), data can be used to create countless
different iterations. It can even provide a bridge that will allow anyone to participate, improve and build on top of these public services.

Wrap Up

At this point, you might wonder why I care so much about bike sharing. To me it’s not about bike sharing anymore. City Bikes is just too
good of an open data metaphor, a simulation in which public information is freely accessible to everyone. It shows the benefits of open
data and the deficiencies that arise from the lack thereof.

We shouldn’t have to create open data by scraping websites. This information should be already available, easily accessed and provided in
a machine-readable format from the original providers, be they city councils or transportation companies. However, until there’s another
option, we’ll always have scraping.


Source : https://blog.scrapinghub.com/2016/03/30/web-scraping-to-create-open-data/




Web Scraping – Ethical Data Collection Activity or an Illegal Practice?

Abiding by the definition, web scrapping is a method to extract data from website. There can be different reasons to perform this task, such as for reporting, market research, to determine share indexes, know website updates, product rate updates, to monitor data, and so on. Besides these, data theft is another of the prominent motives behind web data extraction, which ultimately holds the use of a web scraper as unethical and at times, illegal.

Technical definition

In technical terms, data scraping is a method of collecting data from a website through specific software. These software programs or web scrapers give the website owners the impression of human web surfing and extract a big volume of data, which is usually difficult for any user visitor to access manually. The apps simulate human exploration of online data by embedding web browsers, or implementing HTTP to fulfill the cause of data extractors.

Relation with data mining

Usually, data mining refers to analyzing data from varied perspectives and transforming it to meaningful information that could help in boosting sales or mitigating financial risks in a business. As for web scraping, it involves extraction of analytical data from the web. At present, web scrapping comprises major source of data extraction carried out by data miners. This is because almost everything is now available online and for any data miner, this resource is no less than a gold mine.

The web scraping process

In this data scraping method, the experts look out for tricks to format the URLs into pages that include the usable information. The web scrapers then parse the DOM tree to extract data from the website. In simple language, the web scrapers process the semi-structured or unstructured data pages of the desired website and then convert the resulting data into a well structured form. The users can harvest or modify the structured data in a better manner.

Web scraping – legal or unethical?

It solely relies on your intentions, whether you are doing this activity in the interest of the masses or just wish to satisfy your personal interests. If it is for a goodwill, such as to research on share index to predict the market situation in the coming days, it is fine. Another positive example could be to identify the trend of market and suggest a client on viable business boosting methods accordingly.

However, if you are doing web scraping for personal gratification then it may well be termed as intrusion into one’s personal data. For example, if you are hacking into the database of a university to steal the academic articles and using them in your own project. Any such instance is definitely an act of stealth and may accompany relevant punishment. Concisely, to get hold of someone’s creative work for individual gains is unethical. Such people also deploy several bots to for data scraping or spinning, which in turn choke the search engine results and hardly useful to the internet.

Considerations that deem web scraping illegal

Generally, web scraping is illegal in two instances:

1. When you violate the terms and conditions of the service of the concerned website:

Most of the data-oriented websites disallow data scraping. Hence, if you are trying to extract data from that website, the owner has all the rights to sue you on the offense of breach of contract.

2. When you publish scraped content:

This is yet another condition that may delve you into violating the right of the copyright holders. If you are only scraping the content for fair use, it may be permissible. However, companies often hold all the publishing rights and may file suit against you if you publish their data without their permission.

Remedy to illegal web scraping

Despite running the apprehensions of getting identified, unethical web scrapers deter to steal data from websites. Hence, the web owners themselves need to be alert enough not to fall prey to such fraudulent activities. Indeed, it is your data and you won’t like it to get compromised at any cost. Just like there are many web scraping tools available online, you can also opt for applications that offer protection against web data extraction as a fruitful remedy. These software safeguard your website content from hacking attacks such as bots, denial of service, brute force, session opening and transaction anomalies, and more.

Summary: Technology has two facets – good and bad. It depends on us which one to adopt; the same holds in the case of web scraping as well. We should make sure to use this innovation for the benefit of society and not to steal away some one’s creativity, which is indeed unethical and at times, illegal

Source : http://www.web-parsing.com/blog/ethical-data-collection-activity-or-an-illegal-practice