diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 70c22ad0..00000000
--- a/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-.idea
-projectFilesBackup
-extension.zip
-
diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index c361ff9c..00000000
--- a/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "extension/assets/css-selector"]
- path = extension/assets/css-selector
- url = https://github.com/martinsbalodis/css-selector.git
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 02bbb60b..00000000
--- a/LICENSE
+++ /dev/null
@@ -1,165 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
\ No newline at end of file
diff --git a/README.md b/README.md
index 5a64886a..c12c5d7a 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,27 @@
-# Web Scraper
-Web Scraper is a chrome browser extension built for data extraction from web
+# Web Scraper Plus
+Web Scraper Plus is a chrome browser extension built for data extraction from web
pages. Using this extension you can create a plan (sitemap) how a web site
should be traversed and what should be extracted. Using these sitemaps the
Web Scraper will navigate the site accordingly and extract all data. Scraped
data later can be exported as CSV.
-Install the extension from [Chrome store] [chrome-store]
+Install the extension from [chrome-store]
-### Features
+Document for new features: [wiki]
+
+#### This tool is forked form [Web-Scraper] with many more features
+
+### New Features
+ 1. [CLI Support]: Start scraping from CMD/Terminal
+ 2. [MySQL Support]: Support MySQL database (v5.7+)
+ 3. [Anti Lazy-Loading]: Anti Lazy-Loading feature on pages
+ 4. [Data Filter]: Support user defined JS code for data preprocess and much more
+ 5. [Distinct]: Remove dulplicate data before the end of every task.
+ 6. [Custom Columns]: Define the columns you want to display, please use this feature together with [Data Filter]
+ 7. [Easy Scrape]: Create & scrape sitemap in a more easily way. (Based on https://github.com/aagiss)
+ 8. Random Interval: Add a random delay between requests. (Provided by https://github.com/Euphorbium)
+
+### Features(Forked from original work)
1. Scrape multiple pages
2. Sitemaps and scraped data are stored in browsers local storage or in CouchDB
@@ -20,11 +34,9 @@ Install the extension from [Chrome store] [chrome-store]
### Help
- Documentation and tutorials are available on [webscraper.io] [webscraper.io]
+ Basic documentation and tutorials are available on [webscraper.io]
- Ask for help, submit bugs, suggest features on [google groups] [google-groups]
-
- Submit bugs and suggest features on [bug tracker] [github-issues]
+ Submit bugs and suggest features on [github-issues]
#### Bugs
When submitting a bug please attach an exported sitemap if possible.
@@ -32,30 +44,21 @@ When submitting a bug please attach an exported sitemap if possible.
## License
LGPLv3
-## Changelog
-
-### v0.2
- * Added Element click selector
- * Added Element scroll down selector
- * Added Link popup selector
- * Improved table selector to work with any html markup
- * Added Image download
- * Added keyboard shortcuts when selecting elements
- * Added configurable delay before using selector
- * Added configurable delay between page visiting
- * Added multiple start url configuration
- * Added form field validation
- * Fixed a lot of bugs
-
-### v0.1.3
- * Added Table selector
- * Added HTML selector
- * Added HTML attribute selector
- * Added data preview
- * Added ranged start urls
- * Fixed bug which made selector tree not to show on some operating systems
-
- [chrome-store]: https://chrome.google.com/webstore/detail/web-scraper/jnhgnonknehpejjnehehllkliplmbmhn
+ [Web-Scraper]: https://github.com/martinsbalodis/web-scraper-chrome-extension
+ [chrome-store]: https://chrome.google.com/webstore/detail/pbbfbmlnpackgeofecdfncmmdbodkhma
[webscraper.io]: http://webscraper.io/
- [google-groups]: https://groups.google.com/forum/#!forum/web-scraper
- [github-issues]: https://github.com/martinsbalodis/web-scraper-chrome-extension/issues
+ [github-issues]: https://github.com/hejiheji001/web-scraper-chrome-extension/issues
+ [wiki]: https://github.com/hejiheji001/web-scraper-chrome-extension/wiki
+[MySQL Support]: https://github.com/hejiheji001/web-scraper-chrome-extension/wiki/MySQL-Support
+
+[CLI Support]: https://github.com/hejiheji001/web-scraper-chrome-extension/wiki/CLI-Support
+
+[Anti Lazy-Loading]: https://github.com/hejiheji001/web-scraper-chrome-extension/wiki/Anti-Lazy-Loading
+
+[Data Filter]: https://github.com/hejiheji001/web-scraper-chrome-extension/wiki/Data-Filter
+
+[Distinct]: https://github.com/hejiheji001/web-scraper-chrome-extension/wiki/Distinct
+
+[Custom Columns]: https://github.com/hejiheji001/web-scraper-chrome-extension/wiki/Custom-Columns
+
+[Easy Scrape]: https://github.com/hejiheji001/web-scraper-chrome-extension/wiki/Easy-Scrape
diff --git a/docs/wiki/Anti LazyLoading.png b/docs/wiki/Anti LazyLoading.png
new file mode 100644
index 00000000..ce14d465
Binary files /dev/null and b/docs/wiki/Anti LazyLoading.png differ
diff --git a/docs/wiki/CustomColumns1.png b/docs/wiki/CustomColumns1.png
new file mode 100644
index 00000000..cb5879a5
Binary files /dev/null and b/docs/wiki/CustomColumns1.png differ
diff --git a/docs/wiki/CustomColumns2.png b/docs/wiki/CustomColumns2.png
new file mode 100644
index 00000000..c227853f
Binary files /dev/null and b/docs/wiki/CustomColumns2.png differ
diff --git a/docs/wiki/DataFilter1.png b/docs/wiki/DataFilter1.png
new file mode 100644
index 00000000..501e1f15
Binary files /dev/null and b/docs/wiki/DataFilter1.png differ
diff --git a/docs/wiki/DataFilter2.png b/docs/wiki/DataFilter2.png
new file mode 100644
index 00000000..938fca0e
Binary files /dev/null and b/docs/wiki/DataFilter2.png differ
diff --git a/docs/wiki/DataFilter3.png b/docs/wiki/DataFilter3.png
new file mode 100644
index 00000000..4ceb5d69
Binary files /dev/null and b/docs/wiki/DataFilter3.png differ
diff --git a/docs/wiki/DataFilter4.png b/docs/wiki/DataFilter4.png
new file mode 100644
index 00000000..936b6da5
Binary files /dev/null and b/docs/wiki/DataFilter4.png differ
diff --git a/docs/wiki/Distinct.png b/docs/wiki/Distinct.png
new file mode 100644
index 00000000..3d8016cb
Binary files /dev/null and b/docs/wiki/Distinct.png differ
diff --git a/docs/wiki/MySQL Support.png b/docs/wiki/MySQL Support.png
new file mode 100644
index 00000000..6831c29d
Binary files /dev/null and b/docs/wiki/MySQL Support.png differ
diff --git a/docs/wiki/Selector.png b/docs/wiki/Selector.png
new file mode 100644
index 00000000..e66b0d8d
Binary files /dev/null and b/docs/wiki/Selector.png differ
diff --git a/extension/assets/images/1400.png b/extension/assets/images/1400.png
new file mode 100644
index 00000000..51365998
Binary files /dev/null and b/extension/assets/images/1400.png differ
diff --git a/extension/assets/images/440.png b/extension/assets/images/440.png
new file mode 100644
index 00000000..51365998
Binary files /dev/null and b/extension/assets/images/440.png differ
diff --git a/extension/assets/images/920g.png b/extension/assets/images/920g.png
new file mode 100644
index 00000000..47d60c7a
Binary files /dev/null and b/extension/assets/images/920g.png differ
diff --git a/extension/assets/images/icon128.png b/extension/assets/images/icon128.png
index 559d72d2..05d2e673 100644
Binary files a/extension/assets/images/icon128.png and b/extension/assets/images/icon128.png differ
diff --git a/extension/assets/images/icon16.png b/extension/assets/images/icon16.png
index 6e6cdd18..88cb5086 100644
Binary files a/extension/assets/images/icon16.png and b/extension/assets/images/icon16.png differ
diff --git a/extension/assets/images/icon19.png b/extension/assets/images/icon19.png
index 49debcd9..bb1d610d 100644
Binary files a/extension/assets/images/icon19.png and b/extension/assets/images/icon19.png differ
diff --git a/extension/assets/images/icon38.png b/extension/assets/images/icon38.png
index 70027344..31905993 100644
Binary files a/extension/assets/images/icon38.png and b/extension/assets/images/icon38.png differ
diff --git a/extension/assets/images/icon48.png b/extension/assets/images/icon48.png
index 65e46c34..876b8656 100644
Binary files a/extension/assets/images/icon48.png and b/extension/assets/images/icon48.png differ
diff --git a/extension/background_page/background_script.js b/extension/background_page/background_script.js
index 480287e8..d6e51dfd 100644
--- a/extension/background_page/background_script.js
+++ b/extension/background_page/background_script.js
@@ -27,12 +27,22 @@ var sendToActiveTab = function(request, callback) {
});
};
+var currentChildURLs=null;
+
chrome.runtime.onMessage.addListener(
function (request, sender, sendResponse) {
console.log("chrome.runtime.onMessage", request);
- if (request.createSitemap) {
+ if (request.setCurrentChildURLs) {
+ currentChildURLs=request.urls;
+ sendResponse(request);
+ return true;
+ }else if (request.getCurrentChildURLs) {
+ request.urls=currentChildURLs;
+ sendResponse(request);
+ return true;
+ }else if (request.createSitemap) {
store.createSitemap(request.sitemap, sendResponse);
return true;
}
@@ -51,16 +61,22 @@ chrome.runtime.onMessage.addListener(
else if (request.sitemapExists) {
store.sitemapExists(request.sitemapId, sendResponse);
return true;
+ }else if (request.findSitemap) {
+ store.findSitemap(request.sitemapId, sendResponse);
+ return true;
}
else if (request.getSitemapData) {
+ store.getSitemapData(new Sitemap(request.sitemap), sendResponse);
store.getSitemapData(new Sitemap(request.sitemap), sendResponse);
return true;
}
- else if (request.scrapeSitemap) {
+ else if (request.scrapeSitemap) {//TODO
var sitemap = new Sitemap(request.sitemap);
var queue = new Queue();
var browser = new ChromePopupBrowser({
- pageLoadDelay: request.pageLoadDelay
+ pageLoadDelay: request.pageLoadDelay,
+ scrollToBottom: request.scrollToBottom,
+ urls: sitemap.getStartUrls()
});
var scraper = new Scraper({
@@ -72,8 +88,8 @@ chrome.runtime.onMessage.addListener(
});
try {
- scraper.run(function () {
- browser.close();
+ const callback = function(){
+ //browser.close();
var notification = chrome.notifications.create("scraping-finished", {
type: 'basic',
iconUrl: 'assets/images/icon128.png',
@@ -83,7 +99,14 @@ chrome.runtime.onMessage.addListener(
// notification showed
});
sendResponse();
- });
+ }
+
+ const finalize = function(finalResult){
+ store.removeDuplicate(sitemap._id, request.distinct, finalResult);
+ callback();
+ }
+
+ scraper.run(finalize);
}
catch (e) {
console.log("Scraper execution cancelled".e);
diff --git a/extension/content_script/content_script.js b/extension/content_script/content_script.js
index 7bd00b4b..d021d11b 100644
--- a/extension/content_script/content_script.js
+++ b/extension/content_script/content_script.js
@@ -17,6 +17,7 @@ chrome.runtime.onMessage.addListener(
console.log("received data-preview extraction request", request);
var extractor = new DataExtractor(request);
var deferredData = extractor.getSingleSelectorData(request.parentSelectorIds, request.selectorId);
+
deferredData.done(function(data){
console.log("dataextractor data", data);
sendResponse(data);
@@ -36,6 +37,9 @@ chrome.runtime.onMessage.addListener(
});
return true;
+ }else if(request.notice){
+ console.log("Notification: ", request.message);
+
}
}
);
\ No newline at end of file
diff --git a/extension/content_script/scrollToBottom.js b/extension/content_script/scrollToBottom.js
new file mode 100644
index 00000000..a5c4b0c7
--- /dev/null
+++ b/extension/content_script/scrollToBottom.js
@@ -0,0 +1,13 @@
+chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) {
+ if(message.run){
+ var i = 0;
+ var x = setInterval(function(){
+ window.scrollTo(0, i * 100);
+ i++;
+ if(i * 100 >= document.body.scrollHeight){
+ clearInterval(x);
+ chrome.runtime.sendMessage({antilazyloading: true});
+ }
+ }, 100);
+ }
+});
\ No newline at end of file
diff --git a/extension/devtools/devtools_init_page.js b/extension/devtools/devtools_init_page.js
index 933883fd..3de62f61 100644
--- a/extension/devtools/devtools_init_page.js
+++ b/extension/devtools/devtools_init_page.js
@@ -1 +1 @@
-chrome.devtools.panels.create("Web Scraper", "../assets/images/icon48.png", "devtools/devtools_scraper_panel.html");
\ No newline at end of file
+chrome.devtools.panels.create("Web Scraper Plus", "../assets/images/icon48.png", "devtools/devtools_scraper_panel.html");
\ No newline at end of file
diff --git a/extension/devtools/devtools_scraper_panel.html b/extension/devtools/devtools_scraper_panel.html
index 6f7c4e30..e1ca172f 100644
--- a/extension/devtools/devtools_scraper_panel.html
+++ b/extension/devtools/devtools_scraper_panel.html
@@ -34,6 +34,8 @@
+
+