Remove Gamespot reviews/ads
https://lists.sr.ht/~cadence/breezewiki-discuss/%3C0ad4dbad07a1be394eefe43e33fff860b2d6176e%40disroot.org%3E
This commit is contained in:
		
							parent
							
								
									2e292b4f80
								
							
						
					
					
						commit
						ca13aea547
					
				
					 1 changed files with 8 additions and 1 deletions
				
			
		|  | @ -58,7 +58,9 @@ | ||||||
|                                (data-src "https://static.wikia.nocookie.net/nice-image-thumbnail.png") |                                (data-src "https://static.wikia.nocookie.net/nice-image-thumbnail.png") | ||||||
|                                (class "thumbimage"))))) |                                (class "thumbimage"))))) | ||||||
|                    (figcaption "Test figure!")) |                    (figcaption "Test figure!")) | ||||||
|            (iframe (@ (src "https://example.com/iframe-src"))))))) |            (iframe (@ (src "https://example.com/iframe-src"))) | ||||||
|  |            (div (@ (class "reviews")) | ||||||
|  |                    (header "GameSpot Expert Reviews")))))) | ||||||
| 
 | 
 | ||||||
| (define (updater wikiname #:strict-proxy? [strict-proxy? #f]) | (define (updater wikiname #:strict-proxy? [strict-proxy? #f]) | ||||||
|   ;; precompute wikiurl regex for efficency |   ;; precompute wikiurl regex for efficency | ||||||
|  | @ -238,6 +240,9 @@ | ||||||
|               [(list (list 'img _)) #t] |               [(list (list 'img _)) #t] | ||||||
|               [_ #f])) |               [_ #f])) | ||||||
|        return-no-element] |        return-no-element] | ||||||
|  |       ; remove gamespot reviews/ads | ||||||
|  |       [(has-class? "reviews" attributes) | ||||||
|  |        return-no-element] | ||||||
|       [#t |       [#t | ||||||
|        (list element-type |        (list element-type | ||||||
|              ;; attributes |              ;; attributes | ||||||
|  | @ -297,6 +302,8 @@ | ||||||
|                 "/proxy?dest=https%3A%2F%2Fstatic.wikia.nocookie.net%2Fnice-image.png") |                 "/proxy?dest=https%3A%2F%2Fstatic.wikia.nocookie.net%2Fnice-image.png") | ||||||
|   ; check that noscript images are removed |   ; check that noscript images are removed | ||||||
|   (check-equal? ((query-selector (λ (t a c) (eq? t 'noscript)) transformed)) #f) |   (check-equal? ((query-selector (λ (t a c) (eq? t 'noscript)) transformed)) #f) | ||||||
|  |   ; check that gamespot reviews/ads are removed | ||||||
|  |   (check-equal? ((query-selector (λ (t a c) (has-class? "reviews" a)) transformed)) #f) | ||||||
|   ; benchmark |   ; benchmark | ||||||
|   (when (file-exists? "../storage/Frog.html") |   (when (file-exists? "../storage/Frog.html") | ||||||
|     (with-input-from-file "../storage/Frog.html" |     (with-input-from-file "../storage/Frog.html" | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue