diff options
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | test/test-pages/different-sources-for-images/expected-images.json | 1 | ||||
-rw-r--r-- | test/test-pages/different-sources-for-images/expected-metadata.json | 5 | ||||
-rw-r--r-- | test/test-pages/different-sources-for-images/expected.html | 23 | ||||
-rw-r--r-- | test/test-pages/different-sources-for-images/source.html | 33 | ||||
-rw-r--r-- | test/test-pages/herald-sun-1/expected.html | 2 | ||||
-rw-r--r-- | test/test-pages/infobae/expected-images.json (renamed from test/test-pages/extract-img-url-from-other-sources/expected-images.json) | 0 | ||||
-rw-r--r-- | test/test-pages/infobae/expected-metadata.json (renamed from test/test-pages/extract-img-url-from-other-sources/expected-metadata.json) | 0 | ||||
-rw-r--r-- | test/test-pages/infobae/expected.html (renamed from test/test-pages/extract-img-url-from-other-sources/expected.html) | 0 | ||||
-rw-r--r-- | test/test-pages/infobae/source.html (renamed from test/test-pages/extract-img-url-from-other-sources/source.html) | 0 | ||||
-rw-r--r-- | test/test-pages/mozilla-1/expected.html | 2 |
11 files changed, 65 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 13f903a..d4d56dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file. - Switched from assertEquals to assertSame on unit testing to avoid weak comparisons. - Added a safe check to avoid sending the DOMDocument as a node when scanning for node ancestors. - Fix issue #45: Small mistake in documentation +- Fix issue #46: Added `data-src` as a image source path ## [v1.1.0](https://github.com/andreskrey/readability.php/releases/tag/v1.1.0) diff --git a/test/test-pages/different-sources-for-images/expected-images.json b/test/test-pages/different-sources-for-images/expected-images.json new file mode 100644 index 0000000..65213ea --- /dev/null +++ b/test/test-pages/different-sources-for-images/expected-images.json @@ -0,0 +1 @@ +{"0":"https:\/\/d262ilb51hltx0.cloudfront.net\/max\/800\/1*sLDnS1UWEFIS33uLMxq3cw.jpeg","1":"https:\/\/d262ilb51hltx0.cloudfront.net\/fit\/c\/32\/32\/1*VN9AINEbi2CS8bHWeu80GQ.png","2":"https:\/\/d262ilb51hltx0.cloudfront.net\/fit\/c\/280\/36\/1*CBYh7ADvcY9Z-WYUrJN2Gw.png?source=logoAvatar-lo_69de9372095b-d16afa0ae7c","4":"https:\/\/d262ilb51hltx0.cloudfront.net\/fit\/c\/32\/32\/0*caZ172e36yu_pElb.png","5":"https:\/\/d262ilb51hltx0.cloudfront.net\/max\/2000\/1*sLDnS1UWEFIS33uLMxq3cw.jpeg","6":"https:\/\/d262ilb51hltx0.cloudfront.net\/max\/800\/1*3vIhkoHIzcxvUdijoCVx6w.png","7":"https:\/\/d262ilb51hltx0.cloudfront.net\/max\/2000\/1*4gN1-fzOwCniw-DbqQjDeQ.jpeg","8":"https:\/\/d262ilb51hltx0.cloudfront.net\/max\/2000\/1*2KPmZkIBUrhps-2uwDvYFQ.jpeg","9":"https:\/\/d262ilb51hltx0.cloudfront.net\/max\/2000\/1*PU40bbbox2Ompc5I3RE99A.jpeg","10":"https:\/\/d262ilb51hltx0.cloudfront.net\/max\/800\/1*ohyycinH18fz98TCyUzVgQ.png","11":"https:\/\/d262ilb51hltx0.cloudfront.net\/max\/2000\/1*mKvUNOAVQxl6atCbxbCZsg.jpeg","12":"https:\/\/d262ilb51hltx0.cloudfront.net\/max\/2000\/1*knT10_FNVUmqQIBLnutmzQ.jpeg","14":"https:\/\/d262ilb51hltx0.cloudfront.net\/max\/2000\/1*Vr61dyCTRwk6CemmVF8YAQ.jpeg","15":"https:\/\/d262ilb51hltx0.cloudfront.net\/max\/2000\/1*a-1_13xE6_ErQ-QSlz6myw.jpeg","17":"https:\/\/d262ilb51hltx0.cloudfront.net\/max\/2000\/1*IWXhtSsVv0gNnCwnDEXk-Q.jpeg","18":"https:\/\/d262ilb51hltx0.cloudfront.net\/max\/2000\/1*NGcrjfkV0l37iQH2uyYjEw.jpeg","19":"https:\/\/d262ilb51hltx0.cloudfront.net\/max\/2000\/1*WRlKt3q3mt7utmwxcbl3sQ.jpeg","20":"https:\/\/d262ilb51hltx0.cloudfront.net\/max\/800\/1*320_4I0lxbn5x3bx4XPI5Q.png","21":"https:\/\/d262ilb51hltx0.cloudfront.net\/fit\/c\/60\/60\/1*VN9AINEbi2CS8bHWeu80GQ.png","22":"https:\/\/d262ilb51hltx0.cloudfront.net\/fit\/c\/60\/60\/0*caZ172e36yu_pElb.png"}
\ No newline at end of file diff --git a/test/test-pages/different-sources-for-images/expected-metadata.json b/test/test-pages/different-sources-for-images/expected-metadata.json new file mode 100644 index 0000000..31f1ff3 --- /dev/null +++ b/test/test-pages/different-sources-for-images/expected-metadata.json @@ -0,0 +1,5 @@ +{ + "Title": "Image sources test", + "Author": null, + "Excerpt": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod\n tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,\n quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\n consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse\n cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non\n proident, sunt in culpa qui officia deserunt mollit anim id est laborum." +} diff --git a/test/test-pages/different-sources-for-images/expected.html b/test/test-pages/different-sources-for-images/expected.html new file mode 100644 index 0000000..93f4c92 --- /dev/null +++ b/test/test-pages/different-sources-for-images/expected.html @@ -0,0 +1,23 @@ +<article> + <p> + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse + cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non + proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + </p> + <p>Images</p> + <p><img src="https://test/foo/bar/src.jpg"></img></p> + <p><img data-original="https://test/foo/bar/data-original.jpg" src="https://test/foo/bar/data-original.jpg"></img></p> + <p><img data-orig="https://test/foo/bar/data-orig.jpg" src="https://test/foo/bar/data-orig.jpg"></img></p> + <p><img data-url="https://test/foo/bar/data-url.jpg" src="https://test/foo/bar/data-url.jpg"></img></p> + <p><img data-src="https://test/foo/bar/data-src.jpg" src="https://test/foo/bar/data-src.jpg"></img></p> + <p> + Tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse + cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non + proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + </p> +</article>
\ No newline at end of file diff --git a/test/test-pages/different-sources-for-images/source.html b/test/test-pages/different-sources-for-images/source.html new file mode 100644 index 0000000..8727af6 --- /dev/null +++ b/test/test-pages/different-sources-for-images/source.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"/> + <title>Image sources test</title> +</head> +<body> +<article> + <h1>Lorem</h1> + <div> + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse + cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non + proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + </div> + <p>Images</p> + <p><img src="https://test/foo/bar/src.jpg"/></p> + <p><img data-original="https://test/foo/bar/data-original.jpg"/></p> + <p><img data-orig="https://test/foo/bar/data-orig.jpg"/></p> + <p><img data-url="https://test/foo/bar/data-url.jpg"/></p> + <p><img data-src="https://test/foo/bar/data-src.jpg"/></p> + <div> + Tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse + cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non + proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + </div> +</article> +</body> +</html> diff --git a/test/test-pages/herald-sun-1/expected.html b/test/test-pages/herald-sun-1/expected.html index cc6c977..ec6dbaf 100644 --- a/test/test-pages/herald-sun-1/expected.html +++ b/test/test-pages/herald-sun-1/expected.html @@ -2,7 +2,7 @@ <div class="article-media article-media-main"> <div class="image"> <div class="image-frame"> - <img alt="A new Bill would require telecommunications service providers to store so-called ‘metadat" data-src="http://api.news.com.au/content/1.0/heraldsun/images/1227261885862?format=jpg&group=iphone&size=medium"></img></div> + <img alt="A new Bill would require telecommunications service providers to store so-called ‘metadat" data-src="http://api.news.com.au/content/1.0/heraldsun/images/1227261885862?format=jpg&group=iphone&size=medium" src="http://api.news.com.au/content/1.0/heraldsun/images/1227261885862?format=jpg&group=iphone&size=medium"></img></div> <p class="caption"> <span class="caption-text" id="imgCaption">A new Bill would require telecommunications service providers to store so-called ‘metadata’ for two years.</span> <span class="image-source"><em>Source:</em> diff --git a/test/test-pages/extract-img-url-from-other-sources/expected-images.json b/test/test-pages/infobae/expected-images.json index 7bc23b2..7bc23b2 100644 --- a/test/test-pages/extract-img-url-from-other-sources/expected-images.json +++ b/test/test-pages/infobae/expected-images.json diff --git a/test/test-pages/extract-img-url-from-other-sources/expected-metadata.json b/test/test-pages/infobae/expected-metadata.json index e8b24b1..e8b24b1 100644 --- a/test/test-pages/extract-img-url-from-other-sources/expected-metadata.json +++ b/test/test-pages/infobae/expected-metadata.json diff --git a/test/test-pages/extract-img-url-from-other-sources/expected.html b/test/test-pages/infobae/expected.html index 5d1afcc..5d1afcc 100644 --- a/test/test-pages/extract-img-url-from-other-sources/expected.html +++ b/test/test-pages/infobae/expected.html diff --git a/test/test-pages/extract-img-url-from-other-sources/source.html b/test/test-pages/infobae/source.html index 8d6832e..8d6832e 100644 --- a/test/test-pages/extract-img-url-from-other-sources/source.html +++ b/test/test-pages/infobae/source.html diff --git a/test/test-pages/mozilla-1/expected.html b/test/test-pages/mozilla-1/expected.html index 0c243ce..cb0aff0 100644 --- a/test/test-pages/mozilla-1/expected.html +++ b/test/test-pages/mozilla-1/expected.html @@ -16,7 +16,7 @@ Open the “Customize” panel to add, move or remove any button you want. Keep your favorite features — add-ons, private browsing, Sync and more — one quick click away.</p> - <img alt="" class="js " data-high-res="true" data-high-res-src="//mozorg.cdn.mozilla.net/media/img/firefox/desktop/customize/designed-redesigned-high-res.6efd60766484.png" data-processed="false" data-src="//mozorg.cdn.mozilla.net/media/img/firefox/desktop/customize/designed-redesigned.fbd3ee9402e6.png" id="designed-mobile" src=""></img></div> + <img alt="" class="js " data-high-res="true" data-high-res-src="//mozorg.cdn.mozilla.net/media/img/firefox/desktop/customize/designed-redesigned-high-res.6efd60766484.png" data-processed="false" data-src="//mozorg.cdn.mozilla.net/media/img/firefox/desktop/customize/designed-redesigned.fbd3ee9402e6.png" id="designed-mobile" src="http://mozorg.cdn.mozilla.net/media/img/firefox/desktop/customize/designed-redesigned.fbd3ee9402e6.png"></img></div> <div class="animation-wrapper" id="flexible-bottom-animation"> <img alt="" class="fallback" src="http://mozorg.cdn.mozilla.net/media/img/firefox/desktop/customize/animations/flexible-bottom-fallback.cafd48a3d0a4.png"></img> </div> |