词条 | Web scraping |
释义 |
Web scraping, web harvesting, or web data extraction is data scraping used for extracting data from websites.[1] Web scraping software may access the World Wide Web directly using the Hypertext Transfer Protocol, or through a web browser. While web scraping can be done manually by a software user, the term typically refers to automated processes implemented using a bot or web crawler. It is a form of copying, in which specific data is gathered and copied from the web, typically into a central local database or spreadsheet, for later retrieval or analysis. Web scraping a web page involves fetching it and extracting from it.[1][2] Fetching is the downloading of a page (which a browser does when you view the page). Therefore, web crawling is a main component of web scraping, to fetch pages for later processing. Once fetched, then extraction can take place. The content of a page may be parsed, searched, reformatted, its data copied into a spreadsheet, and so on. Web scrapers typically take something out of a page, to make use of it for another purpose somewhere else. An example would be to find and copy names and phone numbers, or companies and their URLs, to a list (contact scraping). Web scraping is used for contact scraping, and as a component of applications used for web indexing, web mining and data mining, online price change monitoring and price comparison, product review scraping (to watch the competition), gathering real estate listings, weather data monitoring, website change detection, research, tracking online presence and reputation, web mashup and, web data integration. Web pages are built using text-based mark-up languages (HTML and XHTML), and frequently contain a wealth of useful data in text form. However, most web pages are designed for human end-users and not for ease of automated use. Because of this, tool kits that scrape web content were created. A web scraper is an Application Programming Interface (API) to extract data from a web site. Companies like Amazon AWS and Google provide web scraping tools, services and public data available free of cost to end users. Newer forms of web scraping involve listening to data feeds from web servers. For example, JSON is commonly used as a transport storage mechanism between the client and the web server. There are methods that some websites use to prevent web scraping, such as detecting and disallowing bots from crawling (viewing) their pages. In response, there are web scraping systems that rely on using techniques in DOM parsing, computer vision and natural language processing to simulate human browsing to enable gathering web page content for offline parsing. History{{Unreferenced section|date=October 2018}}The history of the web scraping is actually much longer, dating back significantly to the time when the World Wide Web, or colloquially “the Internet”, was born.
TechniquesWeb scraping is the process of automatically mining data or collecting information from the World Wide Web. It is a field with active developments sharing a common goal with the semantic web vision, an ambitious initiative that still requires breakthroughs in text processing, semantic understanding, artificial intelligence and human-computer interactions. Current web scraping solutions range from the ad-hoc, requiring human effort, to fully automated systems that are able to convert entire web sites into structured information, with limitations. Human copy-and-pasteSometimes even the best web-scraping technology cannot replace a human’s manual examination and copy-and-paste, and sometimes this may be the only workable solution when the websites for scraping explicitly set up barriers to prevent machine automation. Text pattern matchingA simple yet powerful approach to extract information from web pages can be based on the UNIX grep command or regular expression-matching facilities of programming languages (for instance Perl or Python). HTTP programmingStatic and dynamic web pages can be retrieved by posting HTTP requests to the remote web server using socket programming. HTML parsingMany websites have large collections of pages generated dynamically from an underlying structured source like a database. Data of the same category are typically encoded into similar pages by a common script or template. In data mining, a program that detects such templates in a particular information source, extracts its content and translates it into a relational form, is called a wrapper. Wrapper generation algorithms assume that input pages of a wrapper induction system conform to a common template and that they can be easily identified in terms of a URL common scheme.[3] Moreover, some semi-structured data query languages, such as XQuery and the HTQL, can be used to parse HTML pages and to retrieve and transform page content. DOM parsing{{Further information|Document Object Model}}By embedding a full-fledged web browser, such as the Internet Explorer or the Mozilla browser control, programs can retrieve the dynamic content generated by client-side scripts. These browser controls also parse web pages into a DOM tree, based on which programs can retrieve parts of the pages. Vertical aggregationThere are several companies that have developed vertical specific harvesting platforms. These platforms create and monitor a multitude of “bots” for specific verticals with no "man in the loop" (no direct human involvement), and no work related to a specific target site. The preparation involves establishing the knowledge base for the entire vertical and then the platform creates the bots automatically. The platform's robustness is measured by the quality of the information it retrieves (usually number of fields) and its scalability (how quick it can scale up to hundreds or thousands of sites). This scalability is mostly used to target the Long Tail of sites that common aggregators find complicated or too labor-intensive to harvest content from. Semantic annotation recognizingThe pages being scraped may embrace metadata or semantic markups and annotations, which can be used to locate specific data snippets. If the annotations are embedded in the pages, as Microformat does, this technique can be viewed as a special case of DOM parsing. In another case, the annotations, organized into a semantic layer,[4] are stored and managed separately from the web pages, so the scrapers can retrieve data schema and instructions from this layer before scraping the pages. Computer vision web-page analysisThere are efforts using machine learning and computer vision that attempt to identify and extract information from web pages by interpreting pages visually as a human being might.[5] SoftwareThere are many software tools available that can be used to customize web-scraping solutions. This software may attempt to automatically recognize the data structure of a page or provide a recording interface that removes the necessity to manually write web-scraping code, or some scripting functions that can be used to extract and transform content, and database interfaces that can store the scraped data in local databases. Some web scraping software can also be used to extract data from an API directly. Example tools
Javascript tools
Web crawling frameworksThese can be used to build web scrapers.
Legal issues{{US-centric|section|date=October 2015}}The legality of web scraping varies across the world. In general, web scraping may be against the terms of use of some websites, but the enforceability of these terms is unclear.[8] United States{{Split section|Web scraping in the United States|discuss=Talk:Web scraping#Split section|date=July 2018}}In the United States, website owners can use three major legal claims to prevent undesired web scraping: (1) copyright infringement (compilation), (2) violation of the Computer Fraud and Abuse Act (“CFAA”), and (3) trespass to chattel.[9] However, the effectiveness of these claims relies upon meeting various criteria, and the case law is still evolving. For example, with regard to copyright, while outright duplication of original expression will in many cases be illegal, in the United States the courts ruled in Feist Publications v. Rural Telephone Service that duplication of facts is allowable. U.S. courts have acknowledged that users of "scrapers" or "robots" may be held liable for committing trespass to chattels,[10][11] which involves a computer system itself being considered personal property upon which the user of a scraper is trespassing. The best known of these cases, eBay v. Bidder's Edge, resulted in an injunction ordering Bidder's Edge to stop accessing, collecting, and indexing auctions from the eBay web site. This case involved automatic placing of bids, known as auction sniping. However, in order to succeed on a claim of trespass to chattels, the plaintiff must demonstrate that the defendant intentionally and without authorization interfered with the plaintiff's possessory interest in the computer system and that the defendant's unauthorized use caused damage to the plaintiff. Not all cases of web spidering brought before the courts have been considered trespass to chattels.[12] One of the first major tests of screen scraping involved American Airlines (AA), and a firm called FareChase.[13] AA successfully obtained an injunction from a Texas trial court, stopping FareChase from selling software that enables users to compare online fares if the software also searches AA's website. The airline argued that FareChase's websearch software trespassed on AA's servers when it collected the publicly available data. FareChase filed an appeal in March 2003. By June, FareChase and AA agreed to settle and the appeal was dropped.[14] Southwest Airlines has also challenged screen-scraping practices, and has involved both FareChase and another firm, Outtask, in a legal claim. Southwest Airlines charged that the screen-scraping is Illegal since it is an example of "Computer Fraud and Abuse" and has led to "Damage and Loss" and "Unauthorized Access" of Southwest's site. It also constitutes "Interference with Business Relations", "Trespass", and "Harmful Access by Computer". They also claimed that screen-scraping constitutes what is legally known as "Misappropriation and Unjust Enrichment", as well as being a breach of the web site's user agreement. Outtask denied all these claims, claiming that the prevailing law in this case should be US Copyright law, and that under copyright, the pieces of information being scraped would not be subject to copyright protection. Although the cases were never resolved in the Supreme Court of the United States, FareChase was eventually shuttered by parent company Yahoo!, and Outtask was purchased by travel expense company Concur.[15]In 2012, a startup called 3Taps scraped classified housing ads from Craigslist. Craigslist sent 3Taps a cease-and-desist letter and blocked their IP addresses and later sued, in Craigslist v. 3Taps. The court held that the cease-and-desist letter and IP blocking was sufficient for Craigslist to properly claim that 3Taps had violated the Computer Fraud and Abuse Act. Although these are early scraping decisions, and the theories of liability are not uniform, it is difficult to ignore a pattern emerging that the courts are prepared to protect proprietary content on commercial sites from uses which are undesirable to the owners of such sites. However, the degree of protection for such content is not settled, and will depend on the type of access made by the scraper, the amount of information accessed and copied, the degree to which the access adversely affects the site owner’s system and the types and manner of prohibitions on such conduct.[16] While the law in this area becomes more settled, entities contemplating using scraping programs to access a public web site should also consider whether such action is authorized by reviewing the terms of use and other terms or notices posted on or made available through the site. In a 2010 ruling in the Cvent, Inc. v. Eventbrite, Inc. In the United States district court for the eastern district of Virginia, the court ruled that the terms of use should be brought to the users' attention In order for a browse wrap contract or license to be enforced.[17] In a 2014, filed in the United States District Court for the Eastern District of Pennsylvania,[18] e-commerce site QVC objected to the Pinterest-like shopping aggregator Resultly’s `scraping of QVC’s site for real-time pricing data. QVC alleges that Resultly “excessively crawled” QVC’s retail site (allegedly sending 200-300 search requests to QVC’s website per minute, sometimes to up to 36,000 requests per minute) which caused QVC's site to crash for two days, resulting in lost sales for QVC.[19] QVC's complaint alleges that the defendant disguised its web crawler to mask its source IP address and thus prevented QVC from quickly repairing the problem. This is a particularly interesting scraping case because QVC is seeking damages for the unavailability of their website, which QVC claims was caused by Resultly. In the plaintiff's web site during the period of this trial the terms of use link is displayed among all the links of the site, at the bottom of the page as most sites on the internet. This ruling contradicts the Irish ruling described below. The court also rejected the plaintiff's argument that the browse wrap restrictions were enforceable in view of Virginia's adoption of the Uniform Computer Information Transactions Act (UCITA)—a uniform law that many believed was in favor on common browse wrap contracting practices.[20] In Facebook, Inc. v. Power Ventures, Inc., a district court ruled in 2012 that Power Ventures could not scrape Facebook pages on behalf of a Facebook user. The case is on appeal, and the Electronic Frontier Foundation filed a brief in 2015 asking that it be overturned.[21][22] In Associated Press v. Meltwater U.S. Holdings, Inc., a court in the US held Meltwater liable for scraping and republishing news information from the Associated Press, but a court in the United Kingdom held in favor of Meltwater. Internet Archive collects and distributes significant number of publicly available webpages without it is considered to be copyright violation. The EUIn February 2006, the Danish Maritime and Commercial Court (Copenhagen) ruled that systematic crawling, indexing, and deep linking by portal site ofir.dk of estate site Home.dk does not conflict with Danish law or the database directive of the European Union.[23] In a February 2010 case complicated by matters of jurisdiction, Ireland's High Court delivered a verdict that illustrates the inchoate state of developing case law. In the case of Ryanair Ltd v Billigfluege.de GmbH, Ireland's High Court ruled Ryanair's "click-wrap" agreement to be legally binding. In contrast to the findings of the United States District Court Eastern District of Virginia and those of the Danish Maritime and Commercial Court, Justice Michael Hanna ruled that the hyperlink to Ryanair's terms and conditions was plainly visible, and that placing the onus on the user to agree to terms and conditions in order to gain access to online services is sufficient to comprise a contractual relationship. [24] The decision is under appeal in Ireland's Supreme Court.[25]AustraliaIn Australia, the Spam Act 2003 outlaws some forms of web harvesting, although this only applies to email addresses.[26][27] Methods to prevent web scrapingThe administrator of a website can use various measures to stop or slow a bot. Some techniques include:
See also{{div col|colwidth=22em}}
References1. ^1 {{cite journal|last1=Boeing|first1=G.|last2=Waddell|first2=P.|title=New Insights into Rental Housing Markets across the United States: Web Scraping and Analyzing Craigslist Rental Listings|journal=Journal of Planning Education and Research|date=2016|issue=0739456X16664789|doi=10.1177/0739456X16664789|arxiv=1605.05397}} 2. ^{{cite journal|author=Vargiu & Urru|title=Exploiting web scraping in a collaborative filtering- based approach to web advertising|journal=Artificial Intelligence Research|date=2013|volume=2|issue=1|doi=10.5430/air.v2n1p44}} 3. ^{{cite journal|last=Song|first=Ruihua|author2=Microsoft Research|title=Joint Optimization of Wrapper Generation and Template Detection|url=https://pdfs.semanticscholar.org/4fb4/3c5a212df751e84c3b2f8d29fabfe56c3616.pdf|journal=The 13th International Conference on Knowledge Discovery and Data Mining|date=Sep 14, 2007}} 4. ^Semantic annotation based web scraping 5. ^{{cite web|url=http://www.xconomy.com/san-francisco/2012/07/25/diffbot-is-using-computer-vision-to-reinvent-the-semantic-web/|title=Diffbot Is Using Computer Vision to Reinvent the Semantic Web|accessdate=2013-03-15|first=Wade|last=Roush|date=2012-07-25|publisher=www.xconomy.com}} 6. ^https://github.com/NikolaiT/GoogleScraper 7. ^{{cite web|url=https://venom.preferred.ai|title=Preferred.AI Venom|accessdate=2019-03-12|publisher=preferred.ai}} 8. ^{{cite web|url=http://www.chillingeffects.org/linking/faq.cgi#QID596|title=FAQ about linking – Are website terms of use binding contracts?|accessdate=2007-08-20|date=2007-08-20|format =|work =|publisher=www.chillingeffects.org|pages =|language =|doi =|archiveurl =https://web.archive.org/web/20020308222536/http://www.chillingeffects.org/linking/faq.cgi#QID596|archivedate =2002-03-08|dead-url=yes|quote =}} 9. ^{{Cite journal|last=Kenneth|first=Hirschey, Jeffrey|date=2014-01-01|title=Symbiotic Relationships: Pragmatic Acceptance of Data Scraping|url=http://scholarship.law.berkeley.edu/btlj/vol29/iss4/16/|journal=Berkeley Technology Law Journal|volume=29|issue=4|doi=10.15779/Z38B39B|issn=1086-3818}} 10. ^{{cite web|url=http://www.tomwbell.com/NetLaw/Ch06.html|title=Internet Law, Ch. 06: Trespass to Chattels|accessdate=2007-08-20|date=2007-08-20|work =|publisher=www.tomwbell.com|pages =|language =|doi =|quote =}} 11. ^{{cite web|url=http://www.chillingeffects.org/linking/faq.cgi#QID460|title=What are the "trespass to chattels" claims some companies or website owners have brought?|accessdate=2007-08-20|date=2007-08-20|format =|work =|publisher=www.chillingeffects.org|pages =|language =|doi =|archiveurl =https://web.archive.org/web/20020308222536/http://www.chillingeffects.org/linking/faq.cgi#QID460|archivedate =2002-03-08|dead-url=yes|quote =}} 12. ^{{cite web|url=http://www.tomwbell.com/NetLaw/Ch07/Ticketmaster.html|title=Ticketmaster Corp. v. Tickets.com, Inc.|accessdate=2007-08-20|date=2007-08-20|work =|publisher =|pages =|language =|doi =|quote =}} 13. ^{{cite web|url=http://www.fornova.net/documents/AAFareChase.pdf|title=American Airlines v. FareChase|accessdate=2007-08-20|date=2007-08-20|work =|publisher =|pages =|language =|doi =|archiveurl =https://web.archive.org/web/20110723131832/http://www.fornova.net/documents/AAFareChase.pdf|archivedate =2011-07-23|dead-url=yes|quote =}} 14. ^{{cite web|url=http://www.thefreelibrary.com/American+Airlines,+FareChase+Settle+Suit.-a0103213546|title=American Airlines, FareChase Settle Suit.|accessdate=2012-02-26|date=2003-06-13|publisher=The Free Library}} 15. ^Imperva (2011). Detecting and Blocking Site Scraping Attacks. Imperva white paper.. 16. ^{{cite web|url=http://library.findlaw.com/2003/Jul/29/132944.html|title=Controversy Surrounds 'Screen Scrapers': Software Helps Users Access Web Sites But Activity by Competitors Comes Under Scrutiny|accessdate=2010-10-27|first=Kenneth A.|last=Adler|date=2003-07-29}} 17. ^{{cite web|url=http://www.fornova.net/documents/Cvent.pdf|title=QVC Inc. v. Resultly LLC, No. 14-06714 (E.D. Pa. filed Nov. 24, 2014)|accessdate=2015-11-05|date=2014-11-24}} 18. ^{{cite web|title=QVC Inc. v. Resultly LLC, No. 14-06714 (E.D. Pa. filed Nov. 24, 2014)|url=https://www.scribd.com/doc/249068700/LinkedIn-v-Resultly-LLC-Complaint?secret_password=pEVKDbnvhQL52oKfdrmT|website=United States District Court for the Eastern District of Pennsylvania|accessdate=5 November 2015}} 19. ^{{cite journal|last1=Neuburger|first1=Jeffrey D|title=QVC Sues Shopping App for Web Scraping That Allegedly Triggered Site Outage|url=http://newmedialaw.proskauer.com/2014/12/05/qvc-sues-shopping-app-for-web-scraping-that-allegedly-triggered-site-outage/|journal=The National Law Review|date=5 December 2014|accessdate=5 November 2015|publisher=Proskauer Rose LLP}} 20. ^{{cite web|url=http://www.fornova.net/documents/pblog-bna-com.pdf|title=Did Iqbal/Twombly Raise the Bar for Browsewrap Claims?|accessdate=2010-10-27|date=2010-09-17}} 21. ^{{Cite web|url=https://www.techdirt.com/articles/20090605/2228205147.shtml|title=Can Scraping Non-Infringing Content Become Copyright Infringement... Because Of How Scrapers Work? {{!}} Techdirt|date=2009-06-10|website=Techdirt.|access-date=2016-05-24}} 22. ^{{Cite web|url=https://www.eff.org/cases/facebook-v-power-ventures|title=Facebook v. Power Ventures|website=Electronic Frontier Foundation|access-date=2016-05-24}} 23. ^{{cite web|url=http://www.bvhd.dk/uploads/tx_mocarticles/S_-_og_Handelsrettens_afg_relse_i_Ofir-sagen.pdf|title=UDSKRIFT AF SØ- & HANDELSRETTENS DOMBOG|accessdate=2007-05-30|date=2006-02-24|publisher=bvhd.dk|deadurl=yes|archiveurl=https://web.archive.org/web/20071012005033/http://www.bvhd.dk/uploads/tx_mocarticles/S_-_og_Handelsrettens_afg_relse_i_Ofir-sagen.pdf|archivedate=2007-10-12|df=|language=Danish}} 24. ^{{cite web|url=http://www.bailii.org/ie/cases/IEHC/2010/H47.html|title=High Court of Ireland Decisions >> Ryanair Ltd -v- Billigfluege.de GMBH 2010 IEHC 47 (26 February 2010)|date=2010-02-26|publisher=British and Irish Legal Information Institute|accessdate=2012-04-19}} 25. ^{{cite web|url=http://www.lkshields.ie/htmdocs/publications/newsletters/update26/update26_03.htm|title=Intellectual Property: Website Terms of Use|date=June 2010|publisher=LK Shields Solicitors Update|work=Issue 26: June 2010|pages=03|first=Áine|last=Matthews|accessdate=2012-04-19}} 26. ^{{cite web|url=https://www.lloyds.com/~/media/5880dae185914b2487bed7bd63b96286.ashx|title=Spam Act 2003: An overview for business|accessdate=2017-12-07 |author=National Office for the Information Economy|date=February 2004|publisher=Australian Communications Authority|pages=6}} 27. ^{{cite web|url=http://www.webstartdesign.com.au/spam_business_practical_guide.pdf|title=Spam Act 2003: A practical guide for business|accessdate=2017-12-07 |author=National Office for the Information Economy|date=February 2004|publisher=Australian Communications Authority|pages=20}} 28. ^Mayank Dhiman [https://s3.us-west-2.amazonaws.com/research-papers-mynk/Breaking-Fraud-And-Bot-Detection-Solutions.pdf Breaking Fraud & Bot Detection Solutions] OWASP AppSec Cali' 2018 Retrieved February 10, 2018. 1 : Web scraping |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。